Create checkout session

Creates a checkout session with a 6-hour TTL. Returns a checkout_url that you can redirect customers to, or use the session ID to build a custom checkout experience. Supports both catalog products (by product_id) and dynamic line items (by name + amount).

POST https://api.pandabase.io/v2/stores/{storeId}/checkouts

Path parameters

storeId string required

Store ID (shp_ prefix)

Body parameters

items array of CatalogItem or DynamicItem required

Line items — use product_id for catalog products or name + amount for dynamic items

title string

Custom title for the checkout page. Defaults to the store name. (length 1–128)

description string

Custom description shown on the checkout page. Not included unless explicitly set. (length 1–500)

amount integer

Expected total in cents. If provided, must match the computed item total (validation safeguard). (range 100–1000000)

customer Customer

No description.

coupon_code string

Coupon code to apply (length 0–64)

tax_id string

Tax ID (VAT number) (length 0–32)

display object

Checkout UI configuration

metadata object

Key-value pairs attached to the session. Flows through to the order and webhook payloads. Max 20 keys, key max 40 chars, value max 500 chars.

return_url uri

URL to redirect after successful payment. Must use HTTPS. (format uri)

cancel_url uri

URL to redirect if the customer cancels. Must use HTTPS. (format uri)

Response 201

Checkout session created

ok boolean required

No description.

data CheckoutSession required

No description.

Response 400

Error response

ok boolean required

No description.

error string required

No description.

Response 404

Error response

ok boolean required

No description.

error string required

No description.

Request
curl -X POST https://api.pandabase.io/v2/stores/:storeId/checkouts \  -H "Content-Type: application/json" \  -d '{"items":[{"product_id":"string","variant_id":"string","quantity":0}],"title":"string","description":"string","amount":0,"customer":{"name":"string","email":"string","billing":{"line1":"string","line2":"string","city":"string","state":"string","postal_code":"string","country":"string"}},"coupon_code":"string","tax_id":"string","display":{"fields":[{"key":"string","label":{"type":"string","custom":"string"},"type":"text","optional":false,"text":{"default_value":"string","minimum_length":0,"maximum_length":0},"numeric":{"default_value":"string","minimum_length":0,"maximum_length":0},"dropdown":{"default_value":"string","options":[]}}]},"metadata":{},"return_url":"string","cancel_url":"string"}'
Response
{  "ok": true,  "data": {    "id": "string",    "title": "string",    "description": "string",    "checkout_url": "string",    "pay_redirect_url": "string",    "merchant": {      "id": "string",      "name": "string",      "handle": "string",      "slug": "string",      "logo": "string",      "favicon": "string",      "accentColor": "string",      "primaryColor": "string",      "statementDescriptor": "string",      "supportEmail": "string"    },    "amount": 0,    "discount_amount": 0,    "tax_amount": 0,    "total_amount": 0,    "coupon": {      "code": "string",      "discount_amount": 0    },    "items": [      {        "name": "string",        "amount": 0,        "quantity": 0,        "image": "string"      }    ],    "display": {},    "metadata": {},    "return_url": "string",    "cancel_url": "string",    "expires_at": 0  }}