All of these requests need your API key, so make them from your server and pass the results to your front end.
1. Create a checkout
Create the checkout as usual. You do not needsuccess_url or cancel_url, because the customer never sees the checkout page.
2. Offer tokens and networks
List tokens returns every token and network that can be used right now.- The minimum. Leave out any token whose
minimumis higher than the checkout’svalue. Networks with a high network cost, such as Bitcoin, have a higher minimum. - Your own settings. If you have turned off some tokens or networks under Settings, then Payment methods, in the dashboard, they still appear in this list. Creating a quote for one of them returns
Invalid token.
decimals for each option. You need it to display amounts.
3. Create a quote
When the customer has chosen, create a quote for that token and network.
Also show the network name clearly, so the customer sends on the right one.
Each quote has its own address, and that address belongs to one checkout. A checkout can have up to 10 quotes. Asking again for the same token and network returns the quote you already have.
When a quote expires
For tokens that are not stablecoins, the amount is based on the price when the quote was made.expires_at is when that amount stops being guaranteed: 20 minutes for most tokens and 60 minutes for BTC.
After expires_at, refresh the quote to get an amount at the current price. The address stays the same.
expires_at and refresh when it runs out. A payment sent after the quote has expired is counted at the market price when it arrived, which can leave the checkout underpaid.
4. Track the payment
Use webhooks to follow the payment from your server.
To get the current state at any time, for example when the customer reloads the page, get the checkout. The response includes every quote with its current
remaining, and every payment.
remaining on each quote drops to what is still owed. Show the customer the new amount and the same address.