# Order payload

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

> Live page: the order payload as four annotated blocks, one open at a time, with the
> order lines shown as a worked example alongside the totals they sum to.

**What's being bought** — `order_lines`, `order_amount`, `order_tax_amount`. Lines do not stop at Kustom. They inform the payment method’s risk assessment, they are what the customer reviews in their payment app afterwards, they reach your TMS when the Kustom Shipping Assistant (KSA) is used, and both capture and refund carry them. One aggregated line costs you acceptance rate, a legible purchase history, carrier selection, mixed tax rates, and any partial refund. See /checkout/tax-and-order-lines/.
**Where the purchase happens** — `purchase_country`, `purchase_currency`, `locale`. These three fix the market: which payment methods appear, which language the checkout speaks, and which currency the amounts are in. purchase_country is fixed at creation. locale and purchase_currency can be updated afterwards, currency only to one your account is enabled for. See /checkout/use-cases/multi-market/.
**Where Kustom calls you back** — `merchant_urls`. Four required URLs, and a fifth that is optional but worth sending. Confirmation is where the customer lands, push is how you learn about the order when the browser never arrives, and validation is the last point at which you can still refuse a purchase you cannot fulfill. Confirmation and push cost money when wrong, and every URL here needs publicly reachable HTTPS with a real certificate — a self-signed one that worked in testing will not. Leaving validation out is a decision either way: without it, an order created an hour ago completes on whatever was true then. See /api/checkout/callbacks/.
**What the order can do** — `options`. Order-level capability: business buyers, age gating, a separate shipping address, VAT display, consent checkboxes. B2B and age verification need your account enabled first, and both are order-level — there is no per-line age flag. See /checkout/checkout-options/.

```json
{
  "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
    }
  ],
  "order_amount": 108000,
  "order_tax_amount": 21600,
  "purchase_country": "SE",
  "purchase_currency": "SEK",
  "locale": "en-SE",
  "merchant_urls": {
    "terms": "https://www.northwind-outfitters.com/terms",
    "checkout": "https://www.northwind-outfitters.com/checkout",
    "confirmation": "https://www.northwind-outfitters.com/checkout/confirmation?order_id={checkout.order.id}",
    "push": "https://www.northwind-outfitters.com/api/kustom/push?order_id={checkout.order.id}",
    "validation": "https://www.northwind-outfitters.com/api/kustom/validate"
  },
  "options": {
    "allow_separate_shipping_address": true
  }
}
```

Values for this example:

| Must hold | Value in this example |
| --- | --- |
| order_amount equals the sum of every line total | `108000` |
| order_tax_amount equals the sum of every line tax | `21600` |
| tshirt-001: quantity x unit_price - discount | `50000` |
| tshirt-001: tax at 25% | `10000` |
| chinos-001: quantity x unit_price - discount | `70000` |
| chinos-001: tax at 25% | `14000` |
| discount-10pct: quantity x unit_price - discount | `-12000` |
| discount-10pct: tax at 25% | `-2400` |

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.

## 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 do not stop at Kustom. Five systems consume the array, and each degrades
differently on a single aggregated line — two of them outside Kustom entirely: the
payment method’s risk assessment, and the TMS reached through the Shipping Service
Callback API.

| Consumer | What it does with them | Cost of one aggregated line |
| --- | --- | --- |
| The payment method's risk check | It reads the lines when deciding whether to accept | Thinner input, lower acceptance |
| The customer's payment app | Where they review the purchase afterwards | "1 item · 250.00" is all they see |
| Your TMS, via the Shipping Assistant | Carriers, pickup points, delivery windows | Cannot route a box it cannot describe |
| Kustom tax validation | Validates tax per line | One rate only — a mixed-rate cart is rejected |
| Capture and refund | Both calls carry order_lines | 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](/checkout/tax-and-order-lines/) for required fields, the `sales_tax`
type and anonymizing product names.

## 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_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](/basics/what-an-order-is/) for the order object and
[Troubleshooting Checkout](/checkout/troubleshooting/) for validation errors.

## 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-options-to-pass).

## 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](/basics/conventions/merchant-data/) for
reference fields, `merchant_data` and `attachment`.

## 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](/checkout/integrate/merchant-urls/) 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](/checkout/integrate/validation-callback/)
explains how to change that behavior. [Server-side callbacks](/checkout/callbacks/) lists the
request and response formats.

## 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](/checkout/checkout-options/) reference for the rest of the field table, and
[Sell to businesses (B2B)](/checkout/use-cases/b2b/) and
[Age verification](/checkout/use-cases/age-verification/) for the two rows above that need
your account enabled first.

## 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 `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.

## Prove it

> Live page: a request runner, which sends this call and shows the response inline. Programmatic equivalent: `POST https://api.playground.kustom.co/checkout/v3/orders`, authenticated with HTTP Basic using your API username and API password.

```json
{
  "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
  }
}
```

A successful request returns `201` with an `order_id` and an `html_snippet`.

Next: [Create an order](/checkout/integrate/create-order/).

## Related

- [Order lines and tax](/checkout/tax-and-order-lines/) — line validation, `sales_tax` lines, anonymizing product names
- [Checkout options](/checkout/checkout-options/) — the full `options` field table
- [Checkout URLs and callbacks](/checkout/integrate/merchant-urls/) — every URL, who calls it and when
- [Your own data on an order](/basics/conventions/merchant-data/) — the three data slots in full
- [Create an order](/checkout/integrate/create-order/) — post this payload
