Checkout sessions and hand-off

Server-priced checkout sessions and the single-use checkout_url that opens Tringify checkout with the session's cart, consent and attribution.

Headless sites and agents never build checkout. A checkout session holds what the shopper wants and who they are; the store prices it with the same engine as its own checkout (taxes, shipping, duties, discounts); its checkout_url opens Tringify checkout, where the shopper pays.

Statuses#

Status

Means

open

Something is missing (requirements says what: lines, contact, shipping_address) or a message needs attention

ready_for_payment

Everything is priced and nothing is missing

handed_off

The checkout_url was opened; the session can no longer change

completed

The order was placed: order_id

expired

24 hours passed

cancelled

Cancelled with POST …/cancel

The session#

  • lines[]: each with status (ok, unavailable, needs_variant, needs_customisation), title, variant title, image, unit_price, line_total and, when it was left out or lowered, a message.

  • shipping_options[] for the address (id, name, price, free) and the chosen shipping_option_id.

  • totals: subtotal, discount, shipping, tax (with tax_included), duties when collected at checkout, fees, total; each money value has amount, currency and display. Until a shipping address is set on a cart that ships, totals holds the merchandise only and tax, shipping and duties are null.

  • messages[]: backend-worded reasons in the shopper's language, for example SHOP_CHECKOUT_ITEM_UNAVAILABLE, SHOP_CHECKOUT_VARIANT_REQUIRED, SHOP_CHECKOUT_ITEM_NEEDS_CUSTOMISATION, SHOP_CHECKOUT_QUANTITY_REDUCED, SHOP_CHECKOUT_ADDRESS_NOT_SHIPPABLE, SHOP_CHECKOUT_SHIPPING_OPTION_UNAVAILABLE, SHOP_CHECKOUT_COUPON_REFUSED. Show them as they are.

  • checkout_url: present while the session can still be handed off and at least one line can be bought.

Hand-off#

Open checkout_url in the shopper's browser (or an in-app browser). It works once. Tringify checkout opens with the session's lines and discount code in a checkout of its own, prices them again and takes payment. When the session was created with a Tringify-Shop-Session token, checkout also takes that session's consent (no second banner), its browser ID and its touches and click IDs, so the order is attributed exactly as a theme checkout would be, and app server events use the same browser ID.

Orders#

  • The order carries the sales channel: the headless storefront's channel, or AI agents.

  • Its events carry surface: headless or surface: agent, and agent orders the agent's name.

  • An order with no qualifying touch is credited in Analytics to the headless storefront or agent by name (traffic medium Headless storefront or AI agent).

  • An agent session carries no consent unless the agent passes the buyer’s in POST /sessions, so agent orders reach ad platforms only then.

Example#

bash
curl -X POST https://shop.example.com/api/shop/2026-11/checkout-sessions \
  -H 'Tringify-Shop-Key: tfpk_…' -H 'Tringify-Shop-Session: <token>' \
  -H 'Content-Type: application/json' \
  -d '{"country":"IN","lines":[{"product_id":233,"variant_id":1953,"quantity":1}],
       "email":"shopper@example.com",
       "shipping_address":{"first_name":"Asha","last_name":"Rao","address1":"12 MG Road",
         "city":"Bengaluru","province_code":"IN-KA","postal_code":"560001","country_code":"IN"}}'