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
| Field | Type | Required | Description |
|---|---|---|---|
billing_country | string | Yes | ISO 3166-1 alpha-2 (e.g. US, FR) |
billing_postal_code | string | Yes if US | Required when billing_country is US |
billing_first_name | string | Yes | |
billing_last_name | string | Yes | |
billing_email | string | Yes | Email address |
billing_phone | string | No | |
currency | string | Yes | USD or EUR |
products | array | Yes | See Products below |
successUrl | string | No | Redirect URL after successful payment |
failedUrl | string | No | Redirect URL after failed payment |
cancelUrl | string | No | Redirect 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 usingid.unit_pricemust 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"
}'