Server-to-Server (S2S) payments let you collect card details on your own payment form instead of using the hosted checkout page. Card data is securely tokenized in the browser using our JavaScript SDK, and the token is sent to your server to create a payment.
S2S integration requires PCI SAQ A-EP compliance. If you are unsure about your PCI compliance level, use hosted checkout instead.
Call POST /v1/tokens with your publishable key (pk_live_* / pk_test_*) to tokenize card details. You can use the JavaScript SDK or call the API directly. The raw card number never reaches your server.
2
Create payment
Send the tok_* token to your backend, then call POST /v1/payments with the token parameter using your secret access token.
3
Handle 3D Secure (if required)
If the response status is requires_action, redirect the customer to redirect_url to complete 3D Secure authentication.
Collect card details on your payment page and send them to POST /v1/tokens using your publishable key. You can use the JavaScript SDK or call the API directly.
3D Secure required. Redirect customer to redirect_url.
failed
400
Payment failed. Show error to customer.
Handling 3D Secure:
const payment = await response.json();if (payment.status === 'requires_action') { // Redirect customer to 3DS authentication page window.location.href = payment.redirect_url; // After 3DS, customer is redirected to your return_url}
Always include return_url for S2S payments. If 3D Secure is triggered, the customer is redirected to this URL after authentication with status=succeeded or status=failed as a query parameter. Without return_url, the customer will have no redirect destination after 3DS.
You can save the customer’s card during an S2S token payment by adding save_card: true and customer_id to the payment request. After the payment completes (including 3D Secure if required), the card is saved and a payment_method_id is returned in the webhook.
The publishable key (pk_test_* / pk_live_*) is used to authenticate tokenization requests from the browser. It can only be used to create tokens and cannot access payments, customers, or any other API resources.You can obtain your publishable key from the merchant dashboard under Merchant Settings > API Settings.For details, see Authentication.