Your server
Your server is the only part of the integration that holds the private API key. Never send the key to the browser or to a mobile app.- Create an API key in the Integrations panel of the dashboard. Store the private key securely, because the dashboard doesn’t keep a copy.
- Sign a JSON Web Token (JWT) with the key for every API call. The server-side SDKs sign the token for you.
- Create a checkout session for each checkout. A checkout session links every attempt to pay for the same order, and it can hold cart items and metadata.
- For Embed, sign a token for the checkout and send it to your checkout page or app with the checkout session ID.
- Create, capture, and refund transactions with the API or a server-side SDK.
Your checkout
Your checkout collects the payment details. The approach you choose decides whether the checkout or your server creates the transaction.
Embed returns the transaction ID to your checkout when it creates the transaction. Send the ID to your server, and get the transaction from the API to confirm its status before you fulfill the order.
To compare the approaches in more detail, see Accept payments on the web and Accept payments on mobile.
Webhooks
Webhooks send an event to your server when a transaction, a buyer, or another resource changes. Use them to keep your system up to date without polling the API.- Add a webhook subscription in the dashboard, under Settings > Manage Integrations > Webhook subscriptions. See Webhooks.
- Respond with a
2XXstatus within 5000 milliseconds. The platform retries any other response for up to 7 days. See Technical considerations. - Check the signature of each request to confirm it comes from the platform.