Skip to main content
Every integration has three parts. Your server holds the API key and calls the API. Your checkout collects payment details from the buyer. Webhooks tell your server when a transaction changes.

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.
  1. Create an API key in the Integrations panel of the dashboard. Store the private key securely, because the dashboard doesn’t keep a copy.
  2. Sign a JSON Web Token (JWT) with the key for every API call. The server-side SDKs sign the token for you.
  3. 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.
  4. For Embed, sign a token for the checkout and send it to your checkout page or app with the checkout session ID.
  5. 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.
  1. Add a webhook subscription in the dashboard, under Settings > Manage Integrations > Webhook subscriptions. See Webhooks.
  2. Respond with a 2XX status within 5000 milliseconds. The platform retries any other response for up to 7 days. See Technical considerations.
  3. Check the signature of each request to confirm it comes from the platform.
Each event holds a snapshot of the resource at the time of the change. Get the resource from the API before you take an action that you can’t undo, such as shipping an order. See Payloads.