How a crypto payment gateway works, step by step
A crypto payment gateway takes one order through 8 stages. It creates a checkout, quotes a price in the token the customer picks, issues a deposit address, detects the transfer on the blockchain, waits for confirmations, converts the payment, settles it to the merchant and sends a webhook that marks the order paid. The customer acts once, in the middle. The rest is automatic, and each stage has its own way of failing.
The 8 stages at a glance
The statuses and events in this table are CoinStack's, taken from its public docs. Other gateways use different names for the same steps. Plain definitions of confirmation, finality, settlement and the other terms are in the crypto payment glossary.
| Stage | What happens | Status or event | What can go wrong |
|---|---|---|---|
| 1. Checkout | The amount owed is fixed in US dollars | Checkout pending | Nobody pays before it expires |
| 2. Quote | The amount is priced in a token and held | Quote with expires_at | The customer pays after the hold ends |
| 3. Address | The customer gets an address, amount and QR code | Quote address and uri | Wrong network, or an amount that arrives short |
| 4. Detection | The transfer is seen on the blockchain | Checkout confirming, payment pending | The store treats this as paid |
| 5. Confirmations | The gateway waits until the transfer is safe | Still confirming | A slow or replaced Bitcoin transaction |
| 6. Conversion | The payment is converted to USDC | No change | It cannot be processed and is returned |
| 7. Settlement | USDC reaches the merchant's wallet | Payment completed | The total is short, so the checkout is partial |
| 8. Webhook | The store is told | Checkout completed, checkout.completed event | The store's server does not answer |
The example below is order 1042 for $25.00, paid with USDC on Base. Its numbers come from the worked example in the CoinStack fees and settlement guide.
Stage 1: the checkout fixes what is owed
A payment starts when your store or billing system asks the gateway for a checkout. In CoinStack that is one API request, a plugin acting when the customer chooses crypto, or a checkout made by hand in the dashboard. The amount can be in any of 146 currencies. It is converted to US dollars once, at creation, and that figure does not change afterwards.
For order 1042 the checkout holds a value of 25.00, a fee of 0.20 (0.8% of the value), the status pending, a page URL and an expiry. The expiry is 24 hours by default and can be set from 10 minutes to 365 days.
What goes wrong here is simple: nobody pays, and the checkout becomes expired. Some gateways run this clock much shorter. BitPay's invoice states give the customer 15 minutes, and BTCPay Server's store settings say "The invoice timer is set to 15 minutes by default." In those products one timer covers both the life of the invoice and the price. CoinStack keeps the 2 apart, which is the next stage.
Stage 2: the quote turns dollars into a token amount
The customer opens the checkout page and picks a token and a network. The gateway now prices the order in that token.
For a stablecoin the arithmetic is trivial: order 1042 asks for 25 USDC. For anything else the gateway takes the market price at that moment. If ETH trades at $1,600, a $200 order is quoted at 0.125 ETH. The quote is held for a limited time so the amount does not move while the customer opens a wallet. CoinStack keeps a BTC quote for 60 minutes and the quote for any other non-stablecoin for 20 minutes. Stablecoin amounts have no time limit.
The failure is a payment that arrives after the hold. CoinStack counts a late non-stablecoin payment at the market price when it arrives. If ETH is 2% lower by then, the same 0.125 ETH is worth $196. That is $4 short, well outside the default underpayment allowance of 0.5%, so the checkout becomes partial and stays open for the rest. Price locks covers this case, and it is one reason stablecoins make simpler payments.
Stage 3: the deposit address ties the payment to the order
With the quote comes a deposit address. In CoinStack each checkout gets its own address for each token and network the customer chooses, so anything that arrives there belongs to that order. The page shows the address, the exact amount and a QR code. There is no wallet to connect. The customer copies the details into any wallet or into an exchange's withdrawal form.
This is the one stage a person performs by hand, and 2 kinds of mistake begin here.
Ethereum, Base, Arbitrum, Optimism, Polygon, Avalanche, BNB Smart Chain and HyperEVM all use the same 0x address format, so a wallet will accept the checkout's address on a network the checkout did not ask for. Whether such a transfer can be recovered depends on the gateway and the case. Wrong-network payments goes through them.
CoinGate found that over the 12 months to the end of August 2026, 11.25% of paid orders "arrived with too much" and about 6.9% "arrived with too little". One cause of a shortfall is an exchange that takes its withdrawal fee out of the amount sent, a case BTCPay Server's store documentation describes: when a customer pays from an exchange wallet, "the exchange takes a small amount of fee" and the invoice ends up paid partially. Kraken's fee table lists 1 USDC for a USDC withdrawal on Base. If that fee came out of order 1042's 25 USDC, 24 USDC would arrive, which is 4% short.
Stage 4: the gateway detects the transfer
The gateway watches the deposit address. When the customer's transfer appears, CoinStack records a payment with the status pending, moves the checkout to confirming, and sends the payment.pending and checkout.confirming webhook events. The checkout page updates by itself, and from this point the customer can close it.
Plugins show this state in the store. In WooCommerce the order is put on hold with a note, and in WHMCS the invoice shows as Payment Pending. The PrestaShop module creates the order only now, with the status Awaiting crypto payment, so an abandoned checkout never becomes an order.
The mistake to avoid is treating detection as payment. A detected transfer has been seen. It has not yet been confirmed, converted or settled.
Stage 5: how many confirmations does a gateway wait for?
A confirmation is a new block added to the chain after the block that contains the transfer. Each one makes the transfer harder to undo. Bitcoin.org's FAQ says new blocks arrive "approximately every 10 minutes on average" and that "Every user is free to determine at what point they consider a transaction sufficiently confirmed."
That freedom shows in the numbers companies choose. Kraken's deposit table, updated October 22, 2026, waits 3 confirmations for Bitcoin and 250 for Polygon, about 25 minutes. Circle's table for its Mint service waits 4 confirmations for Bitcoin and 2 to 3 for Polygon PoS, about 8 seconds. The Polygon network is the same in both cases. The difference is each company's appetite for risk.
Gateways make the same judgment, and it decides how long your customer waits. On a fast network the wait is short: Base produces a block every 200 milliseconds.
CoinStack does not ask you to choose a confirmation count. The checkout stays confirming until the payment has been processed, which usually takes seconds to a few minutes depending on the network the customer paid on.
Two things go wrong at this stage, both mostly on Bitcoin. A transaction sent with a low fee can wait a long time for its first block. An unconfirmed transaction can also be replaced by its sender: Bitcoin Core 28.0, released October 2, 2024, switched on full replace-by-fee by default. This is why confirming must not release an order. Confirmations explained covers the risk by network and order size.
Stages 6 and 7: conversion and settlement
Once the transfer is safe, the gateway does something with the money. Gateways differ most here. Some forward the coin as it arrived. Some convert it to dollars or euros and credit a balance that is later paid to a bank: BitPay marks an invoice complete when it "has credited the merchant account". CoinStack converts every payment to USDC automatically and settles it on the network the merchant has chosen, to the merchant's wallet or another address they name, and the merchant can convert the balance to fiat and receive it in their bank account. Where the money sits in each model is the subject of custodial vs non-custodial gateways.
When the USDC reaches the wallet, the payment becomes completed. For order 1042, the payment record shows where every cent went:
{
"network": "base",
"token": "USDC",
"status": "completed",
"amount": "25000000",
"value": "24.99375000",
"fee": "0.19995000",
"cost": "0.01736800",
"settled": "24.77643200"
}The customer sent 25 USDC (amount is in the token's smallest unit). Its value is 24.99375 because USDC's market price is rarely exactly one dollar. The 0.8% fee is 0.19995, the network cost is 0.017368, and 24.776432 USDC is in the wallet. The payment also carries 2 transaction hashes, one for the customer's transfer and one for the delivery of the USDC, so either can be looked up in a block explorer.
Two outcomes are possible besides success. A payment that cannot be processed goes back to the sender. The payment's status becomes refunded, a payment.refunded event is sent, and it does not count toward the checkout. If the payment settles but the total is short by more than the allowance, the checkout becomes partial and stays open for the rest, as underpaid crypto payments describes.
Stage 8: the webhook marks the order paid
Order 1042 was paid in full, so the checkout becomes completed and CoinStack sends a checkout.completed event to your server. The request is signed with HMAC-SHA256 in a CoinStack-Signature header, and your server checks the signature before it acts. The plugins for WHMCS, WooCommerce, Blesta and PrestaShop do this and then mark the invoice or order paid.
| Moment | Events sent |
|---|---|
| The transfer is detected | payment.pending, checkout.confirming |
| The USDC reaches your wallet | payment.completed, checkout.completed |
The failure at this stage is on the receiving end. Your server is down, a firewall blocks the request, or the handler takes too long. CoinStack expects a 2xx answer within 10 seconds and otherwise tries again after 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 8 hours and 8 hours. That is 8 attempts over about a day, and after that you can resend the event from the dashboard. The same event can arrive twice, so a handler should record each event_id it has processed. The webhooks guide has the details, and reliable payment webhooks covers retries and duplicates in depth.
Fulfill on checkout.completed, and on checkout.resolved if you accept underpayments by hand. Do not fulfill on payment.completed, because a completed payment can still leave its checkout partial. Do not fulfill because the customer arrived at your thank-you page either: the return link on the checkout page is a link, and the customer may never use it. Every status and flag is listed in checkout and payment statuses, and the demo checkout shows stages 2 and 3 from the customer's side.
Frequently asked questions
How does a gateway know which order a payment belongs to?
By the address. A gateway issues a deposit address that belongs to one checkout, so any transfer that arrives there is credited to that order. In CoinStack each checkout gets its own address for each token and network the customer chooses, and your store links the checkout to the order through the checkout_id or your own reference.
Does the customer have to stay on the checkout page until the payment confirms?
No. Once the transfer has been sent, the gateway follows it on the blockchain whether the page is open or not. Your store learns the result from the webhook, which goes from the gateway's server to yours. This is why the paid signal should never depend on the customer returning to your site.
Why does an order show confirming and not paid?
confirming means a transfer was detected and is being processed. It has not yet been confirmed on its network, converted and settled. In CoinStack this state usually lasts seconds to a few minutes, depending on the network.
What happens if my server is down when the webhook is sent?
CoinStack retries a failed delivery 7 more times over about a day, and every event can be resent from the dashboard after that. The plugins also check for missed updates by themselves: the WHMCS module uses the WHMCS cron to catch up. With a custom integration, you can read the checkout's status through the API at any time.
Can a gateway detect a payment sent from an exchange?
Yes, when the checkout works by address. An exchange withdrawal is an ordinary transfer to the deposit address, and the gateway sees it like any other. One thing differs: the exchange may take its withdrawal fee out of the amount, so the payment can arrive short. Paying straight from an exchange covers that case.