Amounts are recomputed server-side from the catalog: the
request names a price, never a total. amount_minor is accepted only
for a pay-what-you-want price and is floored at that price's minimum.
Idempotency-Key is required and makes the call safe to retry; a
replay returns the original order and its original payment instrument.
Reusing a key for a different cart is a 409.
publishableKeyX-Sorai-Key<token>A store's publishable key, spk_….
Idempotency-Key*stringA client-generated key, unique per checkout attempt.
length <= 255application/jsonstore_id?stringOptional; must match a store-scoped key.
uuidprice_id*stringuuidquantity?integer1 <= value <= 1001amount_minor?integerOnly for a pay-what-you-want price, and floored at that price's minimum. Sending it for a fixed price is a 422; the server never takes a total from a client.
int64bump_price_id?stringMust be a price on the store's configured bump product.
uuiddiscount_code?stringcurrency?stringDefaults to the store's currency. Sorai never converts.
3 <= length <= 3method?stringThe payment method to pay with. Required for an order with something to charge; ignored when the order totals zero, which is settled without a payment method.
email*stringemailname*stringThe buyer's name, required on every order, including one that totals zero. Trimmed, then 2 to 100 characters with at least one letter and no line breaks or control characters.
2 <= length <= 100phone?stringDeprecatedKept for integrations that send it directly. The checkout form no longer asks buyers for a phone number by default; a store can add a phone field to its checkout form to collect one instead.
country?stringWhere the buyer is, as an ISO 3166-1 alpha-2 code. Required when the order has something to charge.
2 <= length <= 2custom_fields?Answers to the store's checkout form. Unknown keys are dropped.
attribution?The _sorai_attr payload, copied onto the order.
ref?stringThe affiliate referral code the visitor arrived with: the
_sorai_ref cookie's value, carried here as its own field rather
than as a key inside attribution, which is first-touch and never
overwritten.
An unknown code, or one whose relationship is not active, simply
attributes nothing; it is never an error, and it never changes a
total.
length <= 64page_id?stringThe page this checkout was started from, for attribution.
Either a page uuid, or the synthetic product:{uuid} form the
storefront's built-in product template sends when a product has no
page of its own; in that case the order records no page and the
product id is recorded on the order's attribution instead.
Omit it when there is nothing to attribute; any other value is a
422 invalid_page_id.
^$|^[0-9a-fA-F-]{36}$|^product:[0-9a-fA-F-]{36}$recover?stringThe token from a link back to an unpaid order. The new order is linked to that one and keeps its affiliate. An invalid token is ignored.
length <= 512checkout_session?stringThe session parameter from a checkout link the merchant's server
opened. price_id and quantity must match what it was opened for,
and a discount code is refused unless the link allows them. An
expired, already paid or unknown session is a 422. While the link has
an order waiting for payment, that order is answered instead of a new
one.
length <= 128The order and the instrument the buyer must pay with.
application/jsonorder_id*stringuuidorder_number*stringstatus*OrderStatuspending means the order is still being set up and
will move on shortly; the buyer can already pay. Only Sorai moves an
order from one status to another.
"pending""awaiting_payment""paid""fulfilled""expired""cancelled""refunded"currency*string3 <= length <= 3total_minor*integerint64service_fee_minor?integerThe service fee the buyer pays on top of total_minor for the chosen method, before tax. 0 when the shop pays it.
int64payment*status_url*stringThe absolute URL of this order's status endpoint on the API, token
included: {api_base}/v1/public/orders/{id}/status?token=…. The
checkout page polls it directly; it is not a page on the checkout
origin.
uritoken*stringThe signed capability for this order's status endpoint.
curl -X POST 'https://api.sorai.ai/v1/public/checkout' \ -H 'Idempotency-Key: string' \ -H 'Content-Type: application/json' \ -d '{ "price_id": "5eff5d89-979e-4e4f-aa76-6cbbbf11362c", "email": "user@example.com", "name": "string"}'{ "order_id": "93101167-9065-4b9c-b98b-5d789a3ed9fe", "order_number": "string", "status": "pending", "currency": "str", "total_minor": 0, "service_fee_minor": 0, "payment": { "method": "string", "status": "pending", "conflict_reason": "product_not_active", "instrument": { "kind": "qr", "qr_string": "string", "bank": "string", "account_number": "string", "account_name": "string", "redirect_url": "http://example.com", "client_secret": "string", "instructions": { "locale": "string", "sections": [ { "title": "string", "steps": [ "string" ] } ] } }, "amount_minor": 0, "expires_at": "2019-08-24T14:15:22Z" }, "status_url": "http://example.com", "token": "string"}