curl --request POST \
--url https://api.tagada.io/api/public/v1/checkout/pay-v2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-cms-token: <x-cms-token>' \
--data '
{
"checkoutSessionId": "ch_1234567890",
"paymentInstrumentId": "pi_1234567890"
}
'{
"order": {
"id": "ord_1234567890",
"status": "paid",
"totalAmount": 2999,
"currency": "USD"
},
"payment": {
"id": "pay_1234567890",
"status": "succeeded",
"amount": 2999,
"currency": "USD"
},
"redirectUrl": "https://mystore.com/thankyou/ord_1234567890"
}Pay checkout session V2
Pay for a checkout session with enhanced control over payment initiation.
Authentication: send the buyer session token in the x-cms-token header. It is the token query parameter of the checkout URL that /checkout/init redirects to. The merchant API key alone is not sufficient: without the token, the call returns 401.
This V2 endpoint provides additional parameters:
- initiatedBy: Specify whether payment was initiated by ‘customer’ (default) or ‘merchant’
- source: Specify the payment source, defaults to ‘checkout’
- paymentFlowId: The payment flow the checkout page was set to charge through. It is used only when the merchant set it for this checkout: a flow pinned on a step of the checkout’s funnel (or of one of the store’s funnels when there is no funnel), or the store’s own flow. Any other flow is ignored and the checkout charges through the funnel step’s pin, else the store’s flow.
These parameters are used for tracking and payment routing.
Calling from your server: send your API key in Authorization: Bearer beside the token, and the shopper’s IP and user agent as your server saw them in customer (ipAddress, userAgent). With the key, your server’s own address is never taken for the shopper’s: without customer, the payment keeps the IP the shopper’s browser gave the checkout, if any. Without the key, the shopper is the caller and customer is ignored.
Closed merchant: when the store’s merchant is closed, the call answers 403 with
code: "FORBIDDEN", the top-level message “This store is not taking orders at the moment.”
and data, a JSON string like every error of this API, decoding to
{ "code": "MERCHANT_CLOSED", "message": ... }, whatever initiatedBy says.
Nothing is written: no order, no payment. Show the message to the shopper; retrying cannot help.
curl --request POST \
--url https://api.tagada.io/api/public/v1/checkout/pay-v2 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'x-cms-token: <x-cms-token>' \
--data '
{
"checkoutSessionId": "ch_1234567890",
"paymentInstrumentId": "pi_1234567890"
}
'{
"order": {
"id": "ord_1234567890",
"status": "paid",
"totalAmount": 2999,
"currency": "USD"
},
"payment": {
"id": "pay_1234567890",
"status": "succeeded",
"amount": 2999,
"currency": "USD"
},
"redirectUrl": "https://mystore.com/thankyou/ord_1234567890"
}Headers
Body
Response
Successful response
