A payment gateway doesn’t actually "charge" a customer’s card in the way you’d think; it first authorizes a hold and then captures that amount later.
Let’s watch this unfold with a hypothetical online store. A customer, Alice, wants to buy a $50 t-shirt.
Transaction Flow:
- Alice places an order: She enters her credit card details on the store’s website.
- Authorization Request: The store’s backend sends a request to its payment gateway (e.g., Stripe, PayPal) to "authorize" $50 against Alice’s card.
- Gateway to Network: The gateway communicates with the card network (Visa, Mastercard).
- Bank Check: The card network contacts Alice’s issuing bank. The bank checks if Alice has sufficient funds and if the card is valid.
- Authorization Response: The bank approves the authorization and places a temporary hold of $50 on Alice’s account. This isn’t a charge yet; it’s a promise that the funds are available. The response travels back through the network and gateway to the store.
- Order Confirmation: The store’s backend receives the "authorized" status and displays an order confirmation to Alice. The $50 is now listed as "pending" or "on hold" on Alice’s bank statement, but it hasn’t left her account.
The "Charge" (Capture):
Later, when the store is ready to ship the t-shirt (or when the business logic dictates), it initiates a capture request for the previously authorized $50.
- Capture Request: The store’s backend tells the payment gateway to "capture" the $50.
- Gateway to Network: The gateway forwards this to the card network.
- Actual Transfer: The card network instructs Alice’s bank to move the $50 from her available balance to the merchant’s account. This is the actual charge.
- Settlement: Over the next few business days, the funds are settled between the banks.
The "Refund" (Void vs. Refund):
This is where things get interesting and often misunderstood.
- Voiding an Authorization: If Alice cancels her order before the store captures the funds, the store can "void" the authorization. This tells the gateway to cancel the pending hold. The $50 is released back to Alice’s available balance immediately (or within a few hours, depending on her bank). No money ever actually moved.
- Refunding a Capture: If Alice cancels after the store has already captured the $50 (meaning the money has left her account and is with the merchant), the store must issue a refund. This is a separate transaction where the merchant’s account sends $50 back to Alice’s account. This involves two money movements: the initial capture, then the refund.
Key Levers and Concepts:
- Authorization Window: Most payment gateways and card networks allow authorizations to be held for a specific period (e.g., 7 days for Visa, 10 days for Mastercard). If a capture isn’t initiated within this window, the authorization automatically expires and is released.
- Capture vs. Partial Capture: A merchant can choose to capture less than the authorized amount. If $50 was authorized, they could capture $30 and the remaining $20 authorization would expire.
- Refunds and Fees: When a capture occurs, the merchant typically pays a transaction fee. When a refund is issued, the merchant usually incurs another fee, and often the original transaction fee is not returned by the payment processor. This is a critical business consideration.
- Idempotency Keys: When making API calls to payment gateways, using idempotency keys is crucial. If a capture or refund request is sent twice due to a network glitch, the idempotency key ensures the action is only processed once, preventing duplicate charges or refunds. For example, in Stripe, you’d use
Idempotency-Key: <unique_id>.
The Mental Model:
Think of authorization as a waiter putting a temporary "hold" on a table for you – they know you’re coming, and the table is yours, but you haven’t ordered or paid yet. Capture is when you actually place your order and pay the bill. A void is like deciding not to eat and leaving the restaurant before ordering – the table is immediately available for someone else. A refund is like going back the next day to return a dish you didn’t like – the money has to be moved back.
The most surprising part for many is that the "charge" on a bank statement often refers to the capture of an authorized amount, not the initial act of placing the order. The authorization is a softer hold, and the capture is the hard transfer of funds.
The next common point of confusion is understanding the timing and conditions under which a refund transaction itself can be reversed or disputed.