ucp_complete_checkout
Complete a UCP checkout session. Transitions to 'completed' status. Idempotent — safe to retry with the same idempotency_key. Use ONLY for a checkout session created with ucp_create_checkout (Universal Commerce Protocol); for the standard flow (create_cart, preview_checkout, complete_checkout) do not call this tool. For a cart built with create_cart use complete_checkout. PAYMENT MANDATE: this tool also requires one. Send it as the payment_mandate argument if your client cannot set headers, or as an X-Payment-Mandate header. It must carry mandate_id, max_amount_cents, currency, exp, sub, aud. Two of these are rejected outright if guessed: exp is an INTEGER of Unix seconds (not an ISO 8601 date), and aud is this store's slug (the one in the URL you are calling, not a domain). Its currency must match the cart's currency. Demo Store enforces max_amount_cents against the cart total; a real merchant may only observe that boundary, so enforce the buyer's limit in the agent too. The mandate is a spending cap you declare to limit yourself — it authorises nothing and does not prove the buyer's consent — and its sub must be the identity you authenticate as. max_amount_cents is the spending limit the person you are buying for gave you: ask them if they gave none. Checkout guide: read the MCP resource trusteed://guides/checkout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ap2 | No | AP2 mandates extension. Required when the checkout carries ap2.merchant_authorization. | |
| meta | No | UCP request metadata. meta['ucp-agent'].profile = URL of the platform profile; it must be an https URL without credentials (at most 2048 characters). | |
| buyer | No | Buyer name and email, needed to request the approval link. | |
| payment | No | UCP payment. With AP2, the Payment Mandate goes in instruments[].credential.token. | |
| agent_key | No | Sandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header. | |
| checkout_id | Yes | UCP checkout session ID (valid UUID) | |
| x402_payload | No | x402: signed payment for the server offer (omit to get it). | |
| payment_option | No | Payment method THE PERSON chose, when preview_checkout returned payment_options. Ask the person; never choose for them. Card numbers and wallet keys are never sent here: the person approves (and, with own_wallet, signs) on the approval page. | |
| idempotency_key | Yes | REQUIRED as an argument in this tool: the `Idempotency-Key` header or `_meta` alone is not enough. 1-128 chars from [A-Za-z0-9._:/-]. Reuse the same value when retrying the same operation. | |
| payment_handler | No | Payment handler the store profile publishes. Omit for default. | |
| payment_mandate | No | Payment mandate with `mandate_id`, `max_amount_cents` (integer, minor units), `currency` (3 letters, must match the cart's), `exp` (expiry as an INTEGER of Unix seconds — not an ISO 8601 date string), `sub` (the identity you authenticate as — it is compared against it) and `aud` (the store slug this mandate is for, e.g. the slug in the URL you are calling — not a domain). It is a spending cap you declare to limit yourself: it authorises nothing and does not prove the buyer's consent. Use this when your client cannot set an `X-Payment-Mandate` header. | |
| shared_payment_token | No | Stripe Shared Payment Token (spt_…) granted by the buyer's agent wallet for payment_method=ACP. Issued by Stripe, scoped to this merchant, amount and currency, and consumed when used: it can be charged once. Only honoured when this deployment enables native ACP settlement. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| label | No | ||
| intent | No | ||
| status | Yes | ||
| totals | Yes | ||
| currency | Yes | ||
| next_step | No | Next-action code, not a tool name: provide_shipping_destination, refresh_shipping_rates, choose_shipping_option, ask_user_payment_method. | |
| created_at | Yes | ||
| expires_at | No | ISO-8601 UTC instant at which this checkout SESSION stops being usable. It is not a stock reservation and not a price guarantee. | |
| extensions | No | `warnings[]` with `code`, `message`, `severity`. | |
| line_items | Yes | ||
| updated_at | Yes | ||
| fulfillment | No | ||
| next_action | No | Only when a person must approve or pay: `url`, `kind`, `retry`. | |
| approval_url | No | ||
| idempotency_key | No | ||
| payment_options | No | When present, ask the person which option they want; never choose for them. | |
| next_step_message | No | ||
| expires_in_seconds | No | Whole seconds left on this checkout SESSION at response time (0 when already past). It is not a stock reservation and not a price guarantee. |