checkout:write.
How it works
1
Create a session on your server
2
Send the payer to the page
Redirect the payer, or link them, to:The page shows your business’s verified name and the amount, takes the card (with 3-D Secure where the bank asks), and shows the result. A declined card leaves the session open, so they can try another card.
3
Confirm the payment
Fetch the session from your server and fulfil the order when
state is completed.Session states
Treat
completed as the only paid state. A processing session isn’t paid yet and doesn’t expire while a payment is in flight.
Checkout doesn’t notify your server yet, and the page doesn’t redirect back to your site. Poll the session from your server (for example every few seconds while the payer is on the page, then less often) until it’s
completed, cancelled or expired. Webhooks are coming.Keeping it secure
- Create sessions on your server. The access token is a secret. The amount comes from your server, so a payer can’t change it.
- The session ID is the payer’s key to the page. Anyone with it can see the amount and pay it. Don’t publish it, but it’s fine in a redirect.
- Check the amount in the completed session matches the order before fulfilling.