Developers

Products, checkout & orders

Catalogue, choices, pricing, inventory, buyer extras, fulfilment and the checkout flow.

Products & catalogue

GET /public/store/info?apiKey=… returns the whole active catalogue in one call: business settings (currency, tax, shipping, tipping, gift cards) plus every active product, its categories and collections. Use GET /public/store/related?apiKey=…&productId=… for up to four related in-stock products, and GET /public/store/reviews?apiKey=…&productId=… for its approved reviews.

Product shape (abridged)
{
  "id": "prod_123",
  "name": "Ceramic Mug",
  "price": 14.5,
  "images": ["https://.../a.jpg", "https://.../b.jpg"],
  "categoryIds": ["cat_1"],
  "stockQuantity": 42,
  "trackInventory": true,
  "preorderEnabled": false,
  "requiresShipping": true,
  "fulfilmentMethod": "delivery_or_collection",
  "options": [{ "id": "opt_1", "name": "Colour", "values": ["Blue", "White"] }],
  "variants": [
    { "id": "var_1", "optionValues": ["Blue"], "price": 14.5, "stockQuantity": 20, "isActive": true }
  ],
  "customizations": [ /* see Buyer extras below */ ],
  "badge": { "type": "bestseller", "label": "Bestseller" },
  "ratingAverage": 4.6,
  "ratingCount": 12
}

Merchandising badge

A product may carry an optional customer-facing badge — a small label such as New, Bestseller, Sale, or free-form custom text set by the merchant. It's null when unset. badge.type is one of new, limited, limited_time, bestseller, exclusive, sale, or custom; badge.label is the display text. This is purely presentational — it carries no pricing, inventory or eligibility meaning, and is separate from any internal tagging the merchant may use.

Choices & variants

A product with no options is sold directly at its own price and stockQuantity. A product with options (e.g. Colour, Size) is sold through its variants instead — each variant carries the specific combination of option values, its own price and stock, and an isActive flag. When a product has variants, checkout requires a variantId, not just a productId. Inactive variants stay visible in past order history but can't be purchased again.

Pricing

The price shown to a buyer is never final until checkout recomputes it server-side from: the product/variant price, any buyer-extra priceDelta, tax (taxRate and taxDisplay: exclusive adds tax on top, inclusive means prices already include it), shipping (flat rate, or free above shippingFreeOverThreshold), a discount code, gift-card redemption, and loyalty points redemption. Do not compute a total client-side and send it to checkout — checkout returns the authoritative total.

Inventory

trackInventory: false means the product is never out of stock and stockQuantity isn't meaningful. When inventory is tracked and stock hits zero, checkout normally rejects the line with 409 — unless preorderEnabled is true, in which case the sale is allowed past zero stock as a pre-order (the resulting order line is flagged isPreorder).

Buyer extras (customisations)

A product's customizations array defines extra fields a buyer answers at checkout — text, textarea, checkbox, radio, dropdown, multiselect, number, date, or file. Each can carry a priceDelta charged once per item when answered. Submit answers as a customizations array on the checkout line item, matched by customizationId.

File uploads are two steps, so raw files and storage paths never touch the checkout payload:

  1. POST /public/commerce/attachments with the file — returns a fileToken, an opaque token scoped to this tenant, item and field.
  2. Include that fileToken (not a file or a path) in the matching StoreCheckoutCustomization entry.

Fulfilment

Each product declares a fulfilmentMethod: delivery, collection, delivery_or_collection, or no_physical (e.g. digital goods, gift cards). When every physical line in a cart allows both delivery and collection, checkout requires selectedFulfilmentMethod; otherwise it's implied by the cart's items. A shippingAddress is required whenever the resolved method is delivery. Collection orders return the business's collectionLocation (name, address, instructions) from GET /public/store/info.

Cart & checkout

POST /public/store/checkout takes the whole cart in one call — items, customer contact details, optional discount code, gift-card code or purchase, loyalty point redemption, tip, and fulfilment details — and returns either a Stripe Checkout URL (hosted) or a PaymentIntent client secret (paymentMode: "embedded", for an on-page Payment Element). If the order is fully covered by a gift card and/or redeemed loyalty points, checkoutUrl is null and the order is already paid.

POST /public/store/checkout — request
{
  "apiKey": "lc_your_key_here",
  "customerName": "Jordan Ellis",
  "customerEmail": "jordan@example.com",
  "customerPhone": "+14155551234",
  "smsConsent": true,
  "items": [
    { "productId": "prod_123", "variantId": "var_1", "quantity": 2 }
  ],
  "discountCode": "WELCOME10",
  "selectedFulfilmentMethod": "delivery",
  "shippingAddress": {
    "line1": "1 Example Street",
    "city": "London",
    "postcode": "E1 6AN",
    "country": "GB"
  },
  "successUrl": "https://yourshop.com/thank-you?order={CHECKOUT_SESSION_ID}",
  "cancelUrl": "https://yourshop.com/cart"
}
201 response
{
  "orderId": "ord_456",
  "orderToken": "a1B2c3D4...",
  "checkoutUrl": "https://checkout.stripe.com/c/pay/...",
  "stripeLivemode": true,
  "discountAmount": 2.9,
  "shippingAmount": 3.5,
  "loyaltyPointsEarned": 29
}

A 409 here means stock changed between the buyer loading the page and submitting checkout — refetch the product and let them re-add the item.

stripeLivemode is read directly from the Stripe Checkout Session or PaymentIntent Stripe created for this order — false means a Stripe test-mode transaction (for example a cs_test_... session id), not a real charge. Base any payment-security decision (releasing goods, marking an order fulfilled) on this field rather than inferring the mode from the checkout URL or session id prefix.

Delivery options and prices

GET /public/store/info returns shippingMode. With "flat", use shippingFlatRate and shippingFreeOverThreshold. With "calculated", the price depends on the address: once the customer has entered it, call POST /public/store/shipping-options with apiKey, the basket items and shippingAddress (at least country, plus postcode in the UK). It returns options, each with id, name, price and days, or an empty list and an error when the shop doesn't deliver there. Send the chosen shippingOptionId with the checkout; without one, the cheapest option is used. Checkout works the price out again, so it's always what the shop's rules say. Prices can depend on the order value, the number of items, or the basket's weight; weights come from the products themselves, so send the items as they are and the server adds them up.

Orders

GET /public/store/order?apiKey=…&token=… returns a confirmation-page summary: status, totals, line items, and — once shipped — trackingCarrier, trackingNumber and trackingUrl. Poll this rather than trusting a client-side redirect, since the buyer can close the tab before Stripe redirects back. Use the orderToken from the checkout response — it's an opaque, single-order credential; the raw orderId is never accepted on its own. Order history for a signed-in customer is available at GET /public/store/my-orders (requires a verified customer session — see the customer auth endpoints in the reference).

End-to-end example: buying a product

  1. GET /public/store/info?apiKey=… — render the catalogue, read each product's price, images, options/variants and any customisation fields.
  2. If the buyer attaches a file to a customisation, POST /public/commerce/attachments first and keep the returned fileToken.
  3. Optionally POST /public/store/validate-discount or /validate-gift-card as the buyer types a code, to show a live preview before checkout.
  4. POST /public/store/checkout with the full cart. Redirect the buyer to the returned checkoutUrl (or mount the Payment Element with clientSecret for embedded mode).
  5. On return, poll GET /public/store/order with the orderToken from step 4 until status confirms payment — don't rely on the redirect alone.