get_purchase_turn
Read a purchase turn that was still running
Reads back a turn from POST /buy-with-saved-card that came back state: running. Poll every few seconds until state is done or failed; the response has the same shape as the POST.
A failed confirm may still have placed the order. Read GET /get-purchase-conversation before sending it again.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| turn_id | Yes | The `turn_id` from `POST /buy-with-saved-card`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cart | No | The most recently shown cart. | |
| note | No | The next step. | |
| carts | No | Every open cart in the conversation, oldest first. | |
| error | No | Present when `state` is `failed`. | |
| reply | No | The shopping assistant's turn as prose, ready to show the holder. | |
| state | No | `running` means the turn is still talking to the merchant; the fields below appear once it is `done`. One of: running, done, failed. | |
| status | No | What to do next. `needs_input`: a question or a cart waiting on a confirm. `awaiting_approval`: send `approval_url` to the holder, then repeat the same confirm. `in_progress`: the order is already being placed; read `GET /get-purchase-conversation` instead of confirming again. `order_placed`. `declined`: see `decline_code`. `conflict`: nothing ran, see `error_code` and confirm the fresh cart's hash. Never branch on `reply`. One of: needs_input, awaiting_approval, in_progress, order_placed, declined, conflict. | |
| catalog | No | The last product search. Empty on a turn that did not search again, so keep the previous one. | |
| turn_id | No | This turn's id. Poll `GET /get-purchase-turn` with it while `state` is `running`. | |
| order_id | No | Set when this turn placed an order. | |
| unmatched | No | Things asked for that did not make it into a cart, with a reason. Show these rather than guessing from `reply`. | |
| card_last4 | No | The saved card that paid, for naming it to the holder. | |
| created_at | No | Milliseconds since the epoch. | |
| error_code | No | On `conflict`: `cart_changed`, `turn_in_progress`, `delivery_address_changed`, or `delivery_address_bound_after_cart`. | |
| approval_url | No | Send to the holder when `status` is `awaiting_approval`. Never open it yourself. | |
| decline_code | No | The machine reason behind `declined`, e.g. `items_unavailable`. | |
| charge_status | No | Whether money moved: `none`, `confirming`, `settled`, or `unknown` (do not retry; read the conversation). One of: none, confirming, settled, unknown, . | |
| conversation_id | No | Send it back on every follow-up and on the confirm. |