The customer buys an item online with a credit or debit card.
That information goes through the payment gateway, which encrypts the data to keep it private, and sends it to the payment processor.
The payment processor sends a request to the customer's issuing bank to check to see that they have enough credit to pay for your stuff.
The issuer responds with a yes (approval) or a no (decline).
The payment processor ends the answer back to you that the sale was approved and also tells your merchant bank to credit your account.