Thread = cart
create_cart returns a cart with an id prefixed thr_. That id is the thread id. Every subsequent call (update_cart, create_checkout, complete_checkout) takes it as thread_id.
X-Shopper-Id header, not a body field.
The response includes the id. Pass it as thread_id on every tool. On REST it is :id in /v1/carts/:id.
Lifecycle
A thread stays open until it is ordered, cancelled, or its order is submitted and fails or has an unknown outcome. It does not time out. Once it ends it cannot be reopened, and any call on it returns
thread_ended (HTTP 410) with the outcome in the message. Start a new thread with create_cart.
complete_checkout does not end the thread. It returns a confirm_url, and the thread ends after the shopper confirms on that page. See Orders.
What a thread holds
The saved card and login are Evervault-encrypted values. See Security.
One merchant, one browser context
Each thread is bound to one merchant, set bymerchant on create_cart. See Merchants for the nine live merchants.
A thread runs on a stored browser context: one per organization, shopper and merchant. The first create_cart for a shopper at a merchant creates it, and every later thread for the same X-Shopper-Id and merchant reuses it. The context keeps the merchant cart and sign-in state, and it outlives the thread. A shopper’s next thread at the same merchant starts on the same context, usually still signed in. Each call borrows a browser from a shared pool and opens it on that context.
When every browser is busy, a call returns browser_unavailable with retry_after_seconds. Nothing changed. Wait and call again.
Merchant sign-in
Every thread shops as the shopper’s own merchant account. Nothing checks sign-in up front: a step that needs the account, such ascreate_checkout, returns sign_in_required when the shopper’s context is signed out. Then:
set_credentialswith{ "thread_id": "thr_…", "type": "login" }. It returns aurl.- Give the
urlto the shopper. They enter their merchant email and password. The password is encrypted in their browser. sign_inwith{ "thread_id": "thr_…" }. It returns{ "signed_in": true }. Retry the step that failed.