How a card payment works
You click Pay and a few seconds later it is done. In between, the shop, the payment gateway, the card network and your bank pass messages around. Walk through them step by step.
The tool could not be loaded. Check your connection and reload the page.
Use the arrow keys to move between steps. Click a term to see what it means, or any row of the timeline.
Terms in this step
Sent
Inside the message
Certificate checks
Where the time goes
Times are typical values for illustration, not measurements.
How it works
The shop never sees the card. Its server creates the payment at the payment gateway through an API and sends you to the gateway's page. You enter the card there, the gateway is PCI DSS certified and works only with a token from then on.
Through the card network (Visa, Mastercard) the gateway asks the bank that issued the card whether 3-D Secure is needed. Under the European PSD2 rules strong two-factor authentication applies, only low-risk payments are exempt.
Authorisation follows: the bank checks the balance and limits and puts a hold on the amount. The money actually moves at settlement, usually the next working day.
The shop learns the result from a webhook, a signed message from the gateway. It cannot rely on the customer returning to the thank-you page, they may close the window. Times are typical values.
When it helps
- Understand why the shop sends you elsewhere to pay and why your bank pings you.
- Explain to a client why an online shop needs a webhook and what happens when the gateway goes down.
- Find where in the process failed payments usually end.
Glossary 21 terms
- TLS
- The encryption layer that turns HTTP into HTTPS. Nobody can read or change the data, and you know you are talking to the right server.
- API
- An interface programs use to talk to each other. The shop creates a payment through the gateway API, much like filling in a form, only automatically.
- API key
- A secret password a server uses to prove itself to another server. It belongs on the server only, never in the browser or in code on GitHub.
- Idempotency
- An operation that is safe to repeat. If a request gets lost and is sent again, the payment is not created twice.
- Redirect
- A server answer saying "go elsewhere" (codes 301, 302). The browser then opens the new address on its own, for example the payment page.
- Payment gateway
- A service that takes card payments for a shop and talks to the banks. For example Stripe, Adyen or GoPay.
- PCI DSS
- The security standard for anyone handling card numbers. That is why shops leave the card to the payment gateway.
- Tokenisation
- Replacing the card number with a random token. The token is useless outside the gateway, so a leak does no harm.
- Encryption
- Turning data into a form nobody can read without the key. Only a meaningless jumble of bytes travels over the network.
- 3-D Secure
- A check that the card is used by its owner. The bank asks you to approve in its app, or lets a low-risk payment through without a challenge.
- Card network
- Visa, Mastercard and the like. They connect the banks of merchants with the banks that issued the cards and pass messages between them.
- Risk scoring
- From the device, location, amount and history the bank estimates whether it is fraud, and decides whether to ask for authentication.
- Push notification
- A message a server sends to an app on your phone, even when the app is not open.
- Strong customer authentication (SCA)
- Two-factor authentication required by the European PSD2 rules: something you have (the phone) and something you know or are (PIN, fingerprint).
- Biometrics
- Authentication by the body: a fingerprint or face. The phone checks it itself and only sends the bank the result.
- Digital signature
- Proof made with a private key that anyone can check with the public key. It can't be forged and reveals any change to the signed data.
- Payment authorisation
- Asking the bank to allow the payment. The bank checks the balance, limits and authentication and answers with a code, 00 means approved.
- Card issuer
- The bank that gave you the card. It decides whether to approve the payment.
- Authorisation hold
- After authorisation the bank puts a hold on the amount. The money actually leaves at settlement, usually the next working day.
- Webhook
- An automatic message one service sends to another when something happens. The gateway uses it to tell the shop the order is paid.
- HTTP status code
- A three-digit number in the response: 200 means OK, 301 a redirect, 404 not found, 500 a server error.
Frequently asked questions
// 01 Does the shop see my card number?
With a standard integration, no. You type the card on the gateway's page or form and the shop only gets the result and a token. That is why the shop does not need full PCI DSS compliance.
// 02 Why do I have to approve the payment in my banking app?
Because of strong customer authentication (SCA) under PSD2. The bank wants two factors: something you have (the phone) and something you are or know (fingerprint, PIN). Only a payment the bank rates as low-risk goes through without a challenge.
// 03 When does the money actually leave my account?
Authorisation only puts a hold on the amount. It is transferred at settlement, usually within one or two working days. If the order is cancelled, the hold is released.
You may also need
Did this save you time?
The tools and simulations are free, ad-free and need no sign-up. If they helped you, you can send a contribution for coffee and new tools.
Donate via PayPalNeed a hand?
I build and maintain web applications in Laravel and PHP. If something on these pages is giving you trouble in a project, get in touch.
Get in touch