- Checkout
- Get started
Create an order
Create a Kustom Checkout order with POST /checkout/v3/orders, store its order_id and reuse the order when the customer returns.
On this page you'll
- Use separate credentials for the production and playground environments
- POST an order and get back an order_id and an html_snippet
- Read an order back from /checkout/v3/orders/{order_id}
curl -X POST 'https://api.playground.kustom.co/checkout/v3/orders' \
-u "$KUSTOM_MERCHANT_ID:$KUSTOM_SECRET" \
-H 'Content-Type: application/json' \
-d '{
"purchase_country": "SE",
"purchase_currency": "SEK",
"locale": "en-SE",
"order_amount": 108000,
"order_tax_amount": 21600,
"order_lines": [
{
"type": "physical",
"reference": "tshirt-001",
"name": "Cotton T-Shirt",
"quantity": 2,
"quantity_unit": "pcs",
"unit_price": 25000,
"tax_rate": 2500,
"total_amount": 50000,
"total_discount_amount": 0,
"total_tax_amount": 10000
},
{
"type": "physical",
"reference": "chinos-001",
"name": "Slim Fit Chinos",
"quantity": 1,
"quantity_unit": "pcs",
"unit_price": 70000,
"tax_rate": 2500,
"total_amount": 70000,
"total_discount_amount": 0,
"total_tax_amount": 14000
},
{
"type": "discount",
"reference": "discount-10pct",
"name": "10% off",
"quantity": 1,
"quantity_unit": "pcs",
"unit_price": -12000,
"tax_rate": 2500,
"total_amount": -12000,
"total_discount_amount": 0,
"total_tax_amount": -2400
}
],
"options": {
"allow_separate_shipping_address": true
}
}'The docs proxy injects your session's credentials. In your own code, use your Playground API username and API password.
POST your order payload to /checkout/v3/orders.
A successful response returns 201 with an order_id and an html_snippet.
Authenticate
Section titled “Authenticate”Every call to the Checkout API uses HTTP Basic auth with your API username and API password, both created in the Kustom Portal. Authentication and environments covers getting them.
Authorization: Basic base64(<API username>:<API password>)| Environment | Base URL |
|---|---|
| Production | https://api.kustom.co |
| Playground | https://api.playground.kustom.co |
Credentials are environment-specific: production credentials don’t work in playground or the reverse. See Authentication and environments for key rotation.
Send the request
Section titled “Send the request”The 201 response contains:
| Field | Where it lives | What it’s for |
|---|---|---|
order_id | Response body | Identifies the order — in every later read and update, and in Order Management later |
html_snippet | Response body | The markup Render and update puts on your page |
See Order payload for the amount validation rules.
Store the order_id
Section titled “Store the order_id”Store order_id on the cart. Use it to read and update the order at
{base URL}/checkout/v3/orders/{order_id}. The 201 response also returns this absolute URL
in the Location header.
Read it back
Section titled “Read it back”GET the order at {base URL}/checkout/v3/orders/{order_id} and you get the order exactly as
Kustom holds it — the fields you sent, plus whatever the customer has added since.
curl -X GET 'https://api.playground.kustom.co/checkout/v3/orders/{order_id}' \
-u "$KUSTOM_MERCHANT_ID:$KUSTOM_SECRET" \
-H 'Content-Type: application/json'The docs proxy injects your session's credentials. In your own code, use your Playground API username and API password.
For updates while the checkout is open, see Render and update.
When the customer comes back
Section titled “When the customer comes back”Reuse the order when the customer returns to preserve the details they’ve entered.
Keep the stored order_id with the session. On re-entry:
- Look for a stored
order_idbefore creating anything. - If there is one,
GETthe order. You get it back with itshtml_snippet, and can update it instead of creating a new one. - If that
GETreturns a 4xx, a 5xx or anything else unexpected, create a new order.
An order expires after 48 hours without activity and can expire sooner. For cart changes, update the existing order using the sequence in Render and update.
When it breaks
Section titled “When it breaks”An order is valid for 48 hours after the last merchant update or customer interaction, then
expires. A GET then returns 404 with an empty body. Create a new order.
POST /checkout/v3/orders has no idempotency key. Retrying after an ambiguous 5xx can
create a duplicate order.
See Troubleshooting Checkout for the full error catalogue,
Idempotency and retries for the calls that do carry a key and
Limits for the rate this call counts against.
Prove it
Section titled “Prove it”Edit the payload in the editor and select Run to create a Playground order. Check the
response for order_id and html_snippet.
Next: Render and update.
Related
Section titled “Related”- Order payload — the payload this page posts
- Render and update — put the
html_snippeton your page, and change the order once it’s there - Authentication and environments — get a key, rotate one
- Troubleshooting Checkout — the full error catalogue
This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.