Skip to main content
The checkout page is the quickest way to accept a payment. If you want the customer to stay inside your own interface, you can ask the API for the payment details and show them yourself. The flow has four parts: create a checkout, let the customer pick a token and network, create a quote for that choice, and track the payment.
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 need success_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.
Before you show an option, check two things:
  • The minimum. Leave out any token whose minimum is higher than the checkout’s value. 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.
Keep 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.
Show the customer three things from the quote: 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.
Show the customer a countdown to 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.
After a partial payment, remaining on each quote drops to what is still owed. Show the customer the new amount and the same address.