Checkout REST Binding
Overview
This document specifies the REST binding for the Checkout Capability. To run the reference implementation for v2026-08-25 locally, see Run the August reference implementation.
The six-step walkthrough uses one session, chk_1234567890. It covers creation, buyer details, fulfillment details, fulfillment selection, completion, and status lookup. Start at Example: Create Checkout. See Failure and idempotent retry for a lost response or a 409 Conflict, and How this page is checked for the full schema validation inputs.
To exercise checkout against a local merchant, start with the official Flower Shop sample.
Protocol Fundamentals
Base URL
All UCP REST endpoints are relative to the business’s base URL, discovered through the UCP profile at /.well-known/ucp.
Content Types
- Request:
application/json - Response:
application/json
Transport Security
All REST endpoints MUST be served over HTTPS with minimum TLS version 1.3.
Operations
| Operation | Method | Endpoint | Description |
|---|---|---|---|
| Create Checkout | POST | /checkout-sessions | Create a checkout session |
| Get Checkout | GET | /checkout-sessions/{id} | Get a checkout session |
| Update Checkout | PUT | /checkout-sessions/{id} | Update a checkout session |
| Complete Checkout | POST | /checkout-sessions/{id}/complete | Place the order |
| Cancel Checkout | POST | /checkout-sessions/{id}/cancel | Cancel a checkout session |
HTTP Headers
UCP-Agent Header
All requests MUST include the UCP-Agent header containing the platform profile URI:
UCP-Agent: profile="https://platform.example/profile"Idempotency-Key
Operations that modify state SHOULD support idempotency via the Idempotency-Key header.
Example: Create Checkout
Under the current official tag v2026-08-25, the create request carries only the line items; the response announces payment handlers under ucp.payment_handlers and pre-selects an instrument in payment.instruments[] (official pinned sample: shopping_checkout_request_create.json).
Request (v2026-08-25):
POST /checkout-sessions HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"line_items": [
{
"item": { "id": "item_123" },
"quantity": 2
}
]
}Response (v2026-08-25, excerpt):
{
"ucp": {
"version": "2026-08-25",
"capabilities": {
"dev.ucp.shopping.checkout": [
{ "version": "2026-08-25" }
]
},
"payment_handlers": {
"com.shopify.shop_pay": [
{
"id": "shop_pay_1234",
"version": "2026-08-25",
"available_instruments": [
{ "type": "shop_pay" }
],
"config": {
"merchant_id": "shop_merchant_123"
}
}
]
}
},
"id": "chk_1234567890",
"status": "incomplete",
"messages": [
{
"type": "error",
"code": "missing",
"path": "$.buyer.email",
"content": "Buyer email is required",
"severity": "recoverable"
}
],
"currency": "USD",
"line_items": [...],
"totals": [
{ "type": "subtotal", "amount": 5000 },
{ "type": "tax", "amount": 400 },
{ "type": "total", "amount": 5400 }
],
"links": [...],
"payment": {
"instruments": [
{
"id": "instr_shop_pay_1",
"handler_id": "shop_pay_1234",
"type": "shop_pay",
"selected": true,
"display": { "email": "[email protected]" }
}
]
}
}Excerpt notes: ucp.capabilities is an object keyed by capability name; messages carries recoverable errors (here: buyer email still missing) alongside the incomplete session; display is a nested object in this version.
Historical shape (v2026-01-11)
The January response placed handlers inside payment.handlers[], kept a payment.selected_instrument_id, and flattened instrument display fields (brand, last_digits) to the top level of each instrument. Handler ids were brand reverse-domain strings (com.google.pay), and instruments[0].handler_id pointed at that brand id:
{
"ucp": {
"version": "2026-01-11",
"capabilities": [
{ "name": "dev.ucp.shopping.checkout", "version": "2026-01-11" }
]
},
"id": "chk_1234567890",
"status": "incomplete",
"payment": {
"handlers": [
{ "id": "com.google.pay", "name": "gpay", "version": "2024-12-03" }
],
"selected_instrument_id": "pi_gpay_5678",
"instruments": [
{
"id": "pi_gpay_5678",
"handler_id": "com.google.pay",
"type": "card",
"brand": "mastercard",
"last_digits": "5678"
}
]
}
}Check which shape a response uses with one command (structure only — no business validation):
python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); ph=r.get("ucp",{}).get("payment_handlers"); print("payment_handlers:", list(ph)[0] if ph else "MISSING: ucp.payment_handlers not found")' create-response.jsonActual output (2026-11-22):
- Against the v2026-08-25 excerpt above:
payment_handlers: com.shopify.shop_pay - Against the January historical example:
payment_handlers: MISSING: ucp.payment_handlers not found
A missing field alone does not identify the protocol version. Compare the negotiated Profile and the response against its schema. When reading old services, map payment.handlers[].id to the new ucp.payment_handlers block and treat brand-string handler_ids as the v2026-01-11 convention — from v2026-01-23 on the handler_id is the session handler id (for example shop_pay_1234).
Example: Update Checkout
Update is a full-replacement PUT: the supplied resource replaces the entire checkout session state, so the Platform MUST resend every previously set field it intends to keep. The Business MUST NOT apply a new update while the session is complete_in_progress; it leaves the checkout unchanged and returns a recoverable error message instead. The v2026-08-25 spec breaks updates into three sub-operations — Update Buyer Info, Update Fulfillment, and Update Fulfillment Selection (v2026-08-25 checkout REST spec); pinned request sample: shopping_checkout_request_update.json. All three steps below run on the same session id (chk_1234567890).
Step 1: Update Buyer Info
Request (v2026-08-25):
PUT /checkout-sessions/{id} HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"buyer": {
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Doe"
},
"line_items": [
{
"item": { "id": "item_123" },
"id": "li_1",
"quantity": 2
}
]
}Response (v2026-08-25, excerpt):
{
"ucp": { "version": "2026-08-25", "...": "capabilities and payment_handlers as in Create" },
"id": "chk_1234567890",
"status": "incomplete",
"messages": [
{
"type": "error",
"code": "missing",
"path": "$.fulfillment.methods[0].selected_destination_id",
"content": "Fulfillment address is required",
"severity": "recoverable"
}
],
"buyer": {
"email": "[email protected]",
"first_name": "Jane",
"last_name": "Doe"
},
"line_items": [...],
"totals": [...],
"payment": { "instruments": [...] }
}The messages array reports what is still missing ($.fulfillment.methods[0].selected_destination_id above) while persisting the buyer fields — progressive completion across calls is the intended pattern. Note how the request resends line_items with the server-assigned li_1 ids: a full-replacement PUT keeps previously set fields only if they are resent.
Step 2: Update Fulfillment
Same PUT, now carrying the shipping method and destination address (buyer and line items resent unchanged):
PUT /checkout-sessions/{id} HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"buyer": { "email": "[email protected]", "first_name": "Jane", "last_name": "Doe" },
"line_items": [
{ "item": { "id": "item_123" }, "id": "li_1", "quantity": 2 }
],
"fulfillment": {
"methods": [
{
"type": "shipping",
"destinations": [
{
"street_address": "123 Main St",
"address_locality": "Springfield",
"address_region": "IL",
"postal_code": "62701",
"address_country": "US"
}
]
}
]
}
}Response (v2026-08-25, excerpt): still "status": "incomplete", now with messages reporting $.selected_fulfillment_option — “Please select a fulfillment option” — and the fulfillment state echoed back with server-assigned ids (shipping_1, dest_home, option groups with standard/express). The session waits for the selection step.
Step 3: Update Fulfillment Selection
The follow-up PUT selects the destination and the shipping option (official example shape):
PUT /checkout-sessions/{id} HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"buyer": { "email": "[email protected]", "first_name": "Jane", "last_name": "Doe" },
"line_items": [
{ "item": { "id": "item_123" }, "id": "li_1", "quantity": 2 }
],
"fulfillment": {
"methods": [
{
"id": "shipping_1",
"type": "shipping",
"line_item_ids": ["li_1"],
"selected_destination_id": "dest_home",
"destinations": [
{
"id": "dest_home",
"street_address": "123 Main St",
"address_locality": "Springfield",
"address_region": "IL",
"postal_code": "62701",
"address_country": "US"
}
],
"groups": [
{ "id": "package_1", "selected_option_id": "express" }
]
}
]
}
}Response (v2026-08-25, excerpt): the session turns completable and publishes the handler Complete must use (v2026-08-25 Update Fulfillment Selection response):
{
"ucp": {
"version": "2026-08-25",
"payment_handlers": {
"com.shopify.shop_pay": [
{
"id": "shop_pay_1234",
"version": "2026-08-25",
"available_instruments": [
{ "type": "shop_pay" }
]
}
]
}
},
"id": "chk_1234567890",
"status": "ready_for_complete"
}Only now does Complete Checkout succeed — with the handler id this response published (shop_pay_1234 under ucp.payment_handlers). The full response also carries messages, line_items, totals, and payment.
The six-step chain on one session. All examples above and below run against the same session chk_1234567890: create → incomplete (missing buyer email) → buyer info → incomplete (missing fulfillment address) → fulfillment → incomplete (missing selected option) → selection → ready_for_complete → complete → completed → get → completed with order ord_99887766. The complete step uses the same handler the ready response published (shop_pay_1234) and the session’s pre-selected instrument; the Google Pay form is kept separately below as the official card-shape variant. Version note: the v2026-01-11 checkout REST spec exposes the same PUT /checkout-sessions/{id} endpoint and sub-operation structure; for the response-envelope differences see the Create historical shape.
Example: Complete Checkout
Complete checkout hands the payment instrument to a handler. Under the current official tag v2026-08-25 the instrument lives in the payment.instruments[] array, linked to its handler by handler_id (official pinned sample: shopping_checkout_request_complete.json; full request and response in the v2026-08-25 checkout REST spec). The request below stays on the six-step session: it uses the same handler the ready_for_complete response published (shop_pay_1234) and that session’s pre-selected instrument (instr_shop_pay_1, returned by the create response). The credential shape follows the Shop Pay token form observed in the Payment Handler guide’s Playground walkthrough — demo data, never a real token:
Request (v2026-08-25, same session):
POST /checkout-sessions/{id}/complete HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"payment": {
"instruments": [
{
"id": "instr_shop_pay_1",
"handler_id": "shop_pay_1234",
"type": "shop_pay",
"selected": true,
"display": { "email": "[email protected]" },
"credential": {
"type": "ShopPayToken",
"token": "shoppay_tok_0f8e3d21-9a7c-4b5e-8f2a-6c1d0e9b3a47"
}
}
]
},
"signals": {
"dev.ucp.buyer_ip": "203.0.113.42",
"dev.ucp.user_agent": "Mozilla/5.0 ..."
}
}Response (v2026-08-25, excerpt, same session):
{
"ucp": {
"version": "2026-08-25",
"capabilities": {
"dev.ucp.shopping.checkout": [
{ "version": "2026-08-25" }
]
},
"payment_handlers": {
"com.shopify.shop_pay": [
{ "id": "shop_pay_1234", "version": "2026-08-25" }
]
}
},
"id": "chk_1234567890",
"status": "completed",
"currency": "USD",
"order": {
"id": "ord_99887766",
"permalink_url": "https://merchant.com/orders/ord_99887766"
}
}Excerpt notes: the full response also carries line_items, totals, and links; a payment_handlers entry may carry config (the handler’s payment-method configuration). The handler_id must match the handler id returned by discovery or the checkout session — not the handler’s brand name.
Official example variant (Google Pay card)
The official v2026-08-25 complete example demonstrates the card instrument shape on a Google Pay session — kept here because it shows the card-only fields (display with brand/last_digits, billing_address, PAYMENT_GATEWAY credential). Against this page’s shop_pay session it would be a handler mismatch; on a session whose ready response publishes gpay_1234 it is the correct form:
POST /checkout-sessions/{id}/complete HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"
Content-Type: application/json
{
"payment": {
"instruments": [
{
"id": "pi_gpay_5678",
"handler_id": "gpay_1234",
"type": "card",
"selected": true,
"display": {
"brand": "mastercard",
"last_digits": "5678",
"card_art": "https://cart-art-1.html",
"description": "Google Pay •••• 5678"
},
"billing_address": {
"street_address": "123 Main St",
"address_locality": "Anytown",
"address_region": "CA",
"address_country": "US",
"postal_code": "12345"
},
"credential": {
"type": "PAYMENT_GATEWAY",
"token": "examplePaymentMethodToken"
}
}
]
},
"signals": {
"dev.ucp.buyer_ip": "203.0.113.42",
"dev.ucp.user_agent": "Mozilla/5.0 ..."
}
}Historical shape (v2026-01-11)
The January version put the payment instrument at the top-level payment_data and named the handler by brand. Kept for reading older services and older samples; do not copy it into new integrations:
{
"payment_data": {
"id": "pi_gpay_5678",
"handler_id": "com.google.pay",
"type": "card",
"credential": {
"type": "PAYMENT_GATEWAY",
"token": "examplePaymentMethodToken"
}
}
}Read against the v2026-08-25 structure, this request puts the instrument in the wrong place: nothing exists at the payment.instruments[0].handler_id path.
Check your request
Save the complete-checkout request body as a JSON file and verify the instrument path with one command (structure only — no business validation):
python3 -c 'import json,sys; req=json.load(open(sys.argv[1])); h=(req.get("payment",{}).get("instruments") or [{}])[0].get("handler_id"); print("handler_id:", h if h else "MISSING: payment.instruments[0].handler_id not found")' complete-request.jsonActual output (2026-11-22):
- Against the shop_pay request above (this session):
handler_id: shop_pay_1234 - Against the Google Pay variant (correct only on a gpay session):
handler_id: gpay_1234 - Against the January historical example:
handler_id: MISSING: payment.instruments[0].handler_id not found
The same check confirms the path on a correct request and reports the “instrument still at top-level payment_data” legacy shape as a missing path — it does not pass silently. Fix direction: move the instrument into payment.instruments[] and set handler_id to the handler’s id from the session. Matching the session’s published handler — not just any handler id — is checked in How this page is checked below.
Example: Get Checkout
Status query — read the current session state without modifying it. Poll it after completing to pick up the order reference (v2026-08-25 checkout REST spec):
Request:
GET /checkout-sessions/{id} HTTP/1.1
UCP-Agent: profile="https://platform.example/profile"Response (v2026-08-25, excerpt):
{
"ucp": { "version": "2026-08-25", "...": "capabilities and payment_handlers as in Create" },
"id": "chk_1234567890",
"status": "completed",
"order": {
"id": "ord_99887766",
"permalink_url": "https://merchant.com/orders/ord_99887766"
},
"line_items": [...],
"buyer": { "email": "[email protected]", "first_name": "Jane", "last_name": "Doe" },
"totals": [...],
"fulfillment": { "...": "shipping methods, destinations, and option groups" },
"payment": { "instruments": [...] }
}A quick assertion for a completed session:
python3 -c 'import json,sys; r=json.load(open(sys.argv[1])); s=r.get("status"); o=(r.get("order") or {}).get("id"); print("status:", s, "| order:", o if o else "MISSING: order.id not found")' checkout-response.jsonActual output (2026-11-22), against the excerpt above: status: completed | order: ord_99887766
Excerpts vs. complete inputs: the response blocks on this page are reading excerpts — [...] and "..." mark omitted parts and such blocks are not runnable as-is. The complete, schema-checked inputs are the pinned-tag scaffold files: shopping_checkout_request_create.json, shopping_checkout_request_update.json, shopping_checkout_request_complete.json, and shopping_checkout_response.json for the session resource this GET returns.
Version note: the v2026-01-11 checkout REST spec serves the same GET /checkout-sessions/{id}; envelope-level differences are the ones documented in the Create historical shape.
Failure and idempotent retry (v2026-08-25)
When a complete request succeeds on the merchant side but the response is lost in transit, the client must be able to recover without creating a second order. The pinned spec’s contract: write operations SHOULD support idempotency via the Idempotency-Key header, and the server MUST (1) store the key with the operation result for at least 24 hours, (2) return the cached result when the same key arrives with a matching body, and (3) return 409 Conflict when the key is reused with a different body (v2026-08-25 HTTP Headers; the signing example uses a UUID-form key, e.g. Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000). See the message signatures specification for the full request-matching rules.
Offline scenario, replayed against the session and request above (fixture-level, 2026-11-22; the merchant is simulated strictly per that contract):
- First complete — server commits order
ord_99887766and caches the response under the key; the client never receives it (simulated transport failure). - Query session state —
GET /checkout-sessions/{id}returnsstatus: completedwith orderord_99887766, telling the client the operation did land. - Replay the same key + same body — served from the idempotency cache: same response, same order id,
replayed=true. - Same key + mismatched body — rejected with
409 Conflict. - Orders created across the whole scenario: exactly 1 — the replay generated no second order. Any assertion failing exits non-zero; the recorded run passed.
Boundaries: protocol — the three MUSTs above are the v2026-08-25 contract, quoted from the pinned source; fixture — this site’s offline merchant simulation implements exactly those semantics (no real merchant, no network, demo payment data); WooCommerce AI plugin — plugin 0.8.0 separately mandates idempotency keys on write operations under its April 2026-04-08 contract (a retry after success replays the response), which is that plugin’s documented behavior, not verified here.
Run the official Flower Shop locally
The official Flower Shop is a transitional sample. Its GET /.well-known/ucp advertises 2026-04-08, and its completion request already uses payment.instruments[].handler_id. Use the sample to exercise the HTTP flow and the pinned schemas on this page to check August request shapes. Pinned merchant sample
- Check out the revision above and run
uv syncinrest/python/server. Follow the server instructions to seed two local SQLite databases withimport_csv.pyand start the server on port 8182. Use the README’s request-signing example with local profile URLs in the loopback environment. Server setup - In a second terminal, run
uv syncinrest/python/client/flower_shop, then runuv run simple_happy_path_client.py --server_url=http://localhost:8182. In our run, cart and checkout creation returned201. After fulfillment selection, completion returned200,completedand an order ID. AGET /orders/{id}with that ID returned200, one bouquet of roses and two ceramic pots. Pinned client - To retry cart creation, reuse the same
Idempotency-Keyand request body. The sample returned201with the same cart ID and identical response bytes. Changing the body while reusing the key returned409 IDEMPOTENCY_CONFLICT. Completing checkout with the sample’sfail_tokenreturned402 INSUFFICIENT_FUNDS. These checks use seeded data and a mock payment handler.
The client generates an ephemeral ES256 key by default. The server logged RFC 9421 signature verified for all eight steps. Those log entries cover HTTP request signatures. AP2 merchant authorization also requires issuing ap2.merchant_authorization in the checkout response. AP2 Mandates extension
Run the August reference implementation
The specification repository also carries an in-progress reference implementation of a Business and a Platform for the August tag (v2026-08-25). The example is pinned to a commit from PR #1090, commit c93eccce85a988217ad890e848781473d632c387. Its discovery document declares 2026-08-25, the same handlers serve REST and MCP, and the single payment handler is the mock com.example.mock_pay with instrument type mock_instrument. It contains no AP2 extension: ap2.merchant_authorization does not appear, and the payment handler always succeeds.
You need uv and a Rust toolchain; the following commands use generator version 2.0.0:
cargo install --locked ucp-schema --version 2.0.0
git clone --no-checkout https://github.com/Universal-Commerce-Protocol/ucp.git ucp-reference
cd ucp-reference
git fetch origin c93eccce85a988217ad890e848781473d632c387
git checkout --detach FETCH_HEAD
make -C reference check # opens no sockets; regenerates and replays REST and MCP
make -C reference serve # keep this running at 127.0.0.1:8182
# In a second terminal, from the same ucp-reference directory:
make -C reference shop TRANSPORT=rest
make -C reference shop TRANSPORT=mcpIn our run, make -C reference check passed the REST and MCP replays for the base and discount combinations (eight calls per scenario and transport, covering ten operations in total, with matching payloads, unchanged transcripts, and passing negative cases). Against the loopback server, both TRANSPORT=rest and TRANSPORT=mcp completed checkout and returned an order; the discounted total was 3240 (3600 − 360, USD minor units). Use the April Flower Shop above to reproduce the earlier profile without installing Rust. Stop the local service with Ctrl+C when finished.
How this page is checked
Two layers, kept separate:
- Per-operation schema validation (official tool). The five main-flow write requests (create, buyer-info update, fulfillment update, selection update, complete) and the separately-listed Google Pay variant were each validated against the pinned v2026-08-25 schemas with the official
ucp-schematool (2.0.0, prebuilt binary from the ucp-schema releases); usage:ucp-schema validate --op <op> --schema .../shopping/checkout.json --schema-local-base .../source/schemas <payload>. All of them validateValidunder their respective operations. The one GET response also validatesValid, but against the complete official scaffoldscripts/scaffolds/shopping_checkout_response.json(--op read) — the Get excerpt on this page omits fields and does not pass the validator on its own. The January legacy request is rejected with"payment" is a required property— the v2026-08-25 complete operation requirespayment.instruments[], which the old top-levelpayment_datashape does not provide. To re-run this yourself: the pinned schemas, scaffolds, and spec source. - Session and idempotency checks (offline fixture). Cross-message facts a single-message validator does not check — the six-step id/status chain on session
chk_1234567890, handler continuity from this page’s ready-response excerpt to the complete request (the Google Pay form is a mismatch on this session), and idempotent replay generating exactly one order — are verified by the offline fixture described in Failure and idempotent retry; any failed assertion exits non-zero.
Status Codes
| Status Code | Description |
|---|---|
200 OK | The request was successful |
201 Created | The resource was successfully created |
400 Bad Request | The request was invalid |
404 Not Found | The requested resource could not be found |
409 Conflict | A conflict prevented the request from completing, such as reusing an idempotency key with a different request body |
500 Internal Server Error | An unexpected error occurred |
Error Responses
Error responses follow the standard UCP error structure:
{
"status": "requires_escalation",
"messages": [
{
"type": "error",
"code": "invalid_cart_items",
"content": "One or more cart items are invalid",
"severity": "requires_buyer_input"
}
]
}Security
Authentication
When authentication is required, REST transport MAY use:
- Open API: No authentication for public operations
- API Keys: Via
X-API-Keyheader - OAuth 2.0: Via
Authorization: Bearer {token}header - Mutual TLS: For high-security environments
See Also
- Checkout Capability - Core checkout specification
- Checkout MCP Binding - Model Context Protocol binding
- Checkout A2A Binding - Agent-to-Agent binding