- Checkout
- Get started
Order payload
Build a Kustom Checkout order payload with itemized lines, valid amounts, merchant URLs, references and options for your integration.
On this page you'll
- Know which of the four blocks each field belongs to
- Send order lines that survive the payment method's risk check, the customer's payment app, your TMS and a partial refund
- Get the four amount identities right the first time
| reference | quantity | unit_price | tax_rate | total_amount | total_tax_amount |
|---|---|---|---|---|---|
| tshirt-001 | 2 | 25000 | 2500 | 50000 | 10000 |
| chinos-001 | 1 | 70000 | 2500 | 70000 | 14000 |
| discount-10pct | 1 | -12000 | 2500 | -12000 | -2400 |
| order | 108000 | 21600 | |||
Three lines, one of them a negative discount. The last row is order_amount and order_tax_amount — the two columns above it, summed. Kustom validates both and rejects the order when they disagree; it never computes them for you. tax_rate carries two implicit decimals, so 2500 is 25%.
The order payload has four main parts:
order_linesand matching totals describe the cart.purchase_country,purchase_currencyandlocaleset the market. Only the country is fixed at creation; currency and locale can be updated later.merchant_urlsspecifies your checkout pages and callback endpoints.optionsconfigures checkout features.
Why one line per item
Section titled “Why one line per item”Send one order_lines entry per cart item. Kustom accepts an aggregated cart line, but
itemized lines support payment assessment, receipts, shipping and partial refunds.
order_lines[]
- The payment method's risk check
- What it does with them: It reads the lines when deciding whether to accept
- Cost of one aggregated line: Thinner input, lower acceptance
- The customer's payment app
- What it does with them: Where they review the purchase afterwards
- Cost of one aggregated line: "1 item · 250.00" is all they see
- Your TMS, via the Shipping Assistant
- What it does with them: Carriers, pickup points, delivery windows
- Cost of one aggregated line: Cannot route a box it cannot describe
- Kustom tax validation
- What it does with them: Validates tax per line
- Cost of one aggregated line: One rate only — a mixed-rate cart is rejected
- Capture and refund
- What it does with them: Both calls carry order_lines
- Cost of one aggregated line: No vocabulary for a partial refund of one item
The payment method, such as Klarna, uses order_lines for its risk assessment. Kustom
passes the lines to the payment method without its own risk assessment. The customer also
sees these lines in their payment app.
| Use | Why itemized lines matter |
|---|---|
| Payment acceptance | The payment method uses the array to assess risk |
| Receipts | The customer’s payment app shows the lines you sent |
| Shipping | With Kustom Shipping Assistant (KSA), the Shipping Service Callback API sends order_lines to the TMS |
| Tax validation | Each line has one tax_rate. A mixed-rate cart needs separate lines |
| Partial refunds | Capture and refund use order_lines to identify individual items |
Give shipping and fees their own typed lines too. See
Order lines and tax for required fields, the sales_tax
type and anonymizing product names.
Why amounts are strict
Section titled “Why amounts are strict”Kustom doesn’t compute these numbers for you — it validates the following and rejects the order if any one fails:
- Amounts are integers in minor units (250.00 SEK is
25000). order_amountequals the sum of everyorder_lines[].total_amount.order_tax_amountequals the sum of everyorder_lines[].total_tax_amount.- Per line,
total_amountequalsquantity×unit_price−total_discount_amount. - Per line,
total_tax_amountsits within ±1 oftotal_amount − total_amount × 10000 / (10000 + tax_rate). tax_ratecarries two implicit decimals, so 25% is2500.
The example above satisfies these rules with three lines, including a negative discount line. See What an order is for the order object and Troubleshooting Checkout for validation errors.
What belongs on the order, and what belongs on each line?
Section titled “What belongs on the order, and what belongs on each line?”Customer details, age requirements, addresses, consent and callback URLs apply to the order. Product details, quantity, price, tax and item references apply to each line.
Age verification and business customer settings belong in order-level options. There is no
per-line age flag. See What options to pass.
What to put in a reference
Section titled “What to put in a reference”| Slot | Lives on | Use it for |
|---|---|---|
order_lines[].reference | each line | Your SKU or catalog id for that item |
merchant_reference1, merchant_reference2 | the order | Your own order number, so a Kustom order can be found from your system and back |
merchant_data | the order, and each line | Anything of yours that only your own code reads |
Generate stable references in your system and reuse them across retries. Changing
merchant_reference1 on every attempt makes duplicate orders harder to match to your records.
If your order number isn’t available at creation, set merchant_reference1 later through
Order Management. See Your own data on an order for
reference fields, merchant_data and attachment.
Where Kustom calls you back
Section titled “Where Kustom calls you back”merchant_urls requires four URLs:
confirmation: the browser redirect after purchase.push: the server-to-server notification, sent even if the browser never reaches confirmation.terms: your terms page.checkout: the page that renders the checkout.
Confirmation and push must be publicly reachable over HTTPS with a trusted certificate. Self-signed certificates aren’t accepted. See Checkout URLs and callbacks for all required and optional URLs.
The example also includes validation, an optional check before purchase. Use it when stock,
prices or fraud checks can change after order creation. By default, an unanswered validation
request allows the purchase after ten seconds. Handle callbacks
explains how to change that behavior. Server-side callbacks lists the
request and response formats.
What options to pass
Section titled “What options to pass”| Pass it | When |
|---|---|
allowed_customer_types: ["person","organization"] | You sell to businesses. Availability is narrower than it looks |
verify_age: { minimum_age: 18 } | Age-restricted goods, NO/SE. Account must be enabled first. Prefer this over the two older identity-number options |
allow_separate_shipping_address | You ship somewhere other than you bill |
vat_removed | B2B summaries where VAT should not show |
| a custom checkbox | Legal requires explicit consent |
| a delivery note (≤255 chars) | You have something to say on the confirmation page |
Colors and corner radius are set in Kustom Portal. See the Checkout options reference for the rest of the field table, and Sell to businesses (B2B) and Age verification for the two rows above that need your account enabled first.
What not to send
Section titled “What not to send”- Address updates after the customer enters an address. Kustom ignores them. Use the address on the order for fulfillment.
- A new
referencefor the same item on every cart. Generate it once and reuse it. - Personal data in
merchant_data. This field stores and returns your data unchanged; don’t use it for personal data.
Prove it
Section titled “Prove it”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.
A successful request returns 201 with an order_id and an html_snippet.
Next: Create an order.
Related
Section titled “Related”- Order lines and tax — line validation,
sales_taxlines, anonymizing product names - Checkout options — the full
optionsfield table - Checkout URLs and callbacks — every URL, who calls it and when
- Your own data on an order — the three data slots in full
- Create an order — post this payload
This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.