Skip to main content

Create payment

Create a payment (hosted checkout session) and get a URL to redirect the customer.

Endpoint

POST /checkout/create/

Authentication: Required (API key with checkout:create scope).

Request body

FieldTypeRequiredDescription
billing_countrystringYesISO 3166-1 alpha-2 (e.g. US, FR)
billing_postal_codestringYes if USRequired when billing_country is US
billing_first_namestringYes
billing_last_namestringYes
billing_emailstringYesEmail address
billing_phonestringNo
currencystringYesUSD or EUR
productsarrayYesSee Products below
successUrlstringNoRedirect URL after successful payment
failedUrlstringNoRedirect URL after failed payment
cancelUrlstringNoRedirect URL when customer cancels

Products

Each item in products is either:

By product ID (from your catalog):

{ "id": "prod_xxx", "quantity": 1 }

By name and price (ad-hoc; only if your organization allows):

{ "name": "Premium Plan", "quantity": 1, "unit_price": 29.99 }
  • id — Your product's public ID. Name and unit_price are optional (loaded from DB).
  • name + unit_price + quantity — Required when not using id. unit_price must be positive.

Response (201)

{
"checkout_url": "https://...",
"token": "...",
"expires_at": 1234567890
}
  • checkout_url — Redirect the customer here to complete payment.
  • token — Signed token; for your records (e.g. to correlate with webhook events).
  • expires_at — Unix timestamp; the token is valid until this time.

Example

curl -X POST "https://api.sandbox.nd8.com/api/checkout/create/" \
-H "Authorization: Api-Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"billing_country": "US",
"billing_postal_code": "10001",
"billing_first_name": "Jane",
"billing_last_name": "Doe",
"billing_email": "jane@example.com",
"currency": "USD",
"products": [{"id": "prod_abc123", "quantity": 2}],
"successUrl": "https://myshop.com/success",
"failedUrl": "https://myshop.com/failed"
}'