Prepare checkout
prepare_orderCreates a draft order from the cart, address, and promo code and returns a pre-filled checkout URL for the human to review and pay.
Instructions
Turn the cart, address and promo into a draft order and return {checkout_url, draft_id, expires_at}. Send checkout_url to the human: checkout opens pre-filled and they review and pay themselves — the agent never pays. Call it only after showing get_order_preview and getting the human's OK. Each call creates a NEW draft with its own number, so call it once per purchase; the cart itself is not emptied. The draft expires after 48 hours. Prices are re-checked; an empty cart, a missing address or no orderable items return an error (with issues) and create nothing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| error | No | Empty cart, missing address or no orderable items. | |
| total | No | ||
| issues | No | ||
| currency | No | ||
| draft_id | No | Draft order number. | |
| expires_at | No | ISO 8601 time when the draft expires (48 h). | |
| checkout_url | No | Pre-filled checkout link — send it to the human to review and pay. |