Skip to content

Order payload

Build a Kustom Checkout order payload with itemized lines, valid amounts, merchant URLs, references and options for your integration.

Starting playground session…
  1. Order payload
  2. Create order
  3. Render and update
  4. Callbacks · optional
  5. Confirm order

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
Three order lines from the example payload, and the order totals they sum to
referencequantityunit_pricetax_ratetotal_amounttotal_tax_amount
tshirt-00122500025005000010000
chinos-00117000025007000014000
discount-10pct1-120002500-12000-2400
order10800021600

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_lines and matching totals describe the cart.
  • purchase_country, purchase_currency and locale set the market. Only the country is fixed at creation; currency and locale can be updated later.
  • merchant_urls specifies your checkout pages and callback endpoints.
  • options configures checkout features.

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.

What one aggregated line costs each consumer.

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.

UseWhy itemized lines matter
Payment acceptanceThe payment method uses the array to assess risk
ReceiptsThe customer’s payment app shows the lines you sent
ShippingWith Kustom Shipping Assistant (KSA), the Shipping Service Callback API sends order_lines to the TMS
Tax validationEach line has one tax_rate. A mixed-rate cart needs separate lines
Partial refundsCapture 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.

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_amount equals the sum of every order_lines[].total_amount.
  • order_tax_amount equals the sum of every order_lines[].total_tax_amount.
  • Per line, total_amount equals quantity × unit_price − total_discount_amount.
  • Per line, total_tax_amount sits within ±1 of total_amount − total_amount × 10000 / (10000 + tax_rate).
  • tax_rate carries two implicit decimals, so 25% is 2500.

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.

SlotLives onUse it for
order_lines[].referenceeach lineYour SKU or catalog id for that item
merchant_reference1, merchant_reference2the orderYour own order number, so a Kustom order can be found from your system and back
merchant_datathe order, and each lineAnything 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.

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.

Pass itWhen
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_addressYou ship somewhere other than you bill
vat_removedB2B summaries where VAT should not show
a custom checkboxLegal 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.

  • Address updates after the customer enters an address. Kustom ignores them. Use the address on the order for fulfillment.
  • A new reference for 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.
POST
/checkout/v3/orders
Line 1 quantity2
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.

This page is also available as Markdown — append .md to its URL — and is indexed in llms.txt.