complete_checkout
Complete the purchase. Collects buyer contact info via elicitation if supported. Idempotent — replay is keyed on checkout_session_id: any retry against a session that already has an order returns that same order (COMPLETED or PENDING_EXTERNAL_CONFIRMATION) without re-charging. The provided idempotency_key is recorded on the session for audit and short-circuits a repeated call with the same key.
SKYFIRE TOKEN (payment_method=KYAPAY): Requires a Skyfire pay or kya-pay token. Preferred: pass the JWT in the skyfire-pay-id request header. Alternative: pass as kyapay_token parameter. Claims validated: sub (account ID), jti (replay prevention), amount (USD, matched against cart total), cur (must be USD), sps (pricing scheme). Missing token with KYAPAY method → error. Invalid token → error 'Invalid Skyfire token'. For other payment methods (MOCK, PAYPAL) no Skyfire token is required. 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, and its currency must match the cart's currency or the call is denied outright. The cap in max_amount_cents is enforced against the cart total. CREDENTIAL: this store needs one. Call the create_sandbox_key tool first (it is in this tool list and needs no credential), then pass the key you get back as the agent_key argument — or as an Authorization: Bearer header if your client can set headers. Do not ask a person to log in: there is no human login for this store.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buyer | No | Optional buyer contact information | |
| agent_key | No | Sandbox credential from `create_sandbox_key`. Use this when your client cannot set an `Authorization: Bearer` header. | |
| cel_context | No | Optional enforcement context for Trusteed native MCP flows (no Shopify/WooCommerce/PrestaShop/Magento plugin). Providing these fields enables full evaluation of rules R004, R006, R008, R012-R013, R015-R017, R022, R026-R029. Fields are validated and signed — do not include values you cannot substantiate. | |
| kyapay_token | No | Skyfire pay or kya-pay JWT for autonomous payment via Skyfire (payment_method=KYAPAY). Alternative to passing the token in the skyfire-pay-id request header — the header takes precedence if both are provided. Claims required: sub, jti, amount (USD), cur=USD, sps. | |
| payment_method | No | Payment method to use. PAYPAL creates a PayPal order and presents approval URL. KYAPAY requires kyapay_token. ACP (Agentic Commerce Protocol / Stripe-native settlement) is NOT enabled by default: unless MCP_ACP_NATIVE_SETTLEMENT_ENABLED=true, a non-zero non-Shopify ACP cart returns an explicit 'not enabled' response instead of a mock completion. Defaults to MOCK if not specified. | |
| idempotency_key | Yes | Unique key to prevent duplicate charges on retry. Generate once per purchase attempt. Replay is enforced primarily on checkout_session_id (the existing order is returned). The first key seen for a session is recorded; reusing the same key short-circuits to the existing order. | |
| payment_mandate | No | Payment mandate with `mandate_id`, `max_amount_cents`, `currency`, `exp`, `sub`, `aud`. Its `currency` must match the cart's. Use this when your client cannot set an `X-Payment-Mandate` header. | |
| checkout_session_id | Yes | Checkout session ID from preview_checkout (must be a valid UUID) | |
| reconfirmed_state_hash | No | SHA-256 of the authoritative merchant state, as returned in details.reconfirm_state_hash by a previous STATE_RECONFIRMATION_REQUIRED error. Required to proceed when the merchant state moved after the approved preview. Passing a stale hash is refused: it means the state moved again and must be reconfirmed anew. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| status | Yes | ||
| currency | Yes | ||
| order_id | Yes | ||
| idempotent | Yes | ||
| store_name | Yes | ||
| payment_url | No | ||
| total_cents | Yes | ||
| external_order_id | No | ||
| checkout_session_id | Yes |