Commerce Orchestrator
Let AI shopping agents check out against the commerce APIs you already run.
The Commerce Orchestrator is an open-source Rust service. It speaks the agentic commerce protocols to agents (UCP, ACP, A2A, MCP, AP2 and MPP) and plain HTTP to your catalog, pricing, tax, geo, payment and receipt backends. You deploy it next to your platform instead of building every new agent protocol into it.
flowchart LR
subgraph Agents["AI agents and clients"]
G["Shopping agents<br/>(UCP / ACP)"]
A["Agent platforms<br/>(A2A / MCP)"]
R["Your apps<br/>(REST)"]
end
subgraph O["Commerce Orchestrator"]
D["Discovery<br/>/.well-known/ucp, agent card"]
F["Cart and checkout<br/>state machine"]
S["Signatures, idempotency,<br/>outbox, metrics"]
end
subgraph B["Your existing backends"]
C[Catalog]
P[Pricing]
T[Tax]
Ge[Geo]
Pa[Payment]
Re[Receipt]
end
G --> O
A --> O
R --> O
O --> C & P & T & Ge & Pa & Re
Start here
- Getting started: run a full checkout and call the server the way an agent would, in about ten minutes.
- FAQ: what it is and is not, which protocol versions it supports, and whether it is ready for your production.
- Architecture: the crates, the request flow, the cart and checkout state machines, idempotency, the outbox and message signing.
Integrate
- Consumer integration: the integration model. Your clients call HTTP; there is no library to embed.
- Consumption guide: every endpoint with request and response shapes, authentication, signing, errors and configuration.
- MCP binding: connect an MCP client, with version negotiation, tools and resources.
- Plug and deploy: connect your backends and deploy to staging and production.
- Provider API: the HTTP API your backends expose to the orchestrator, as an OpenAPI 3.1 spec.
Reference and operations
- Conformance matrix: what each protocol requires, what is covered, and the test that proves it.
- Runbooks: outbox retries, dead-letter replay and payment reconciliation.
- Release checklist: how a version is cut.
Project
The source, issues and discussions are on GitHub. The project is dual-licensed under MIT or Apache-2.0. Changes in each release are in the changelog.
Getting started
This page takes you from a fresh clone to a running orchestrator that answers agent requests, in about ten minutes. Most of that is the first compile. Nothing here needs a database, Docker or any backend of your own: development mode runs against built-in mock providers.
What you need
- Rust 1.94 or newer (
rustc --versionto check). gitandcurl.
1. Clone the repository
git clone https://github.com/AncientiCe/commerce-orchestrator-api.git
cd commerce-orchestrator-api
2. Watch a full checkout run
The happy_path example drives one complete purchase through the orchestrator: create a cart, add an item, reprice, compute tax, check geography, authorize and capture payment, and generate a receipt. Every backend is a mock, so there is nothing to configure.
cargo run -p happy_path
The first build compiles the whole workspace and takes a few minutes. The run itself ends with a line like this:
INFO happy_path: Checkout completed cart_id=… transaction_id=txn_… status=Completed
status=Completed means every step of the checkout flow passed.
3. Start the server
cargo run -p orchestrator-http --bin orchestrator-server
With no configuration file and no ENV=production, the server starts in development mode on 0.0.0.0:8080, with mock providers, in-memory storage and a demo catalog of three items: demo-tee (25.00), demo-mug (12.00) and demo-cap (18.00). Leave it running and open a second terminal.
Check that it is up:
curl -s localhost:8080/health/live
If that prints nothing, another program may be listening on port 8080 too. Use 127.0.0.1:8080 in place of localhost:8080 in the commands below.
4. Shop the way an agent would
The commands below go from discovery to a paid order. Set two shell variables first to keep them short:
API=localhost:8080/api/v1; JSON='content-type: application/json'
Discover the merchant. An agent’s first request is the UCP business profile. It lists the supported UCP versions, the services and their endpoints, the signing keys and the payment handlers. A2A agents read /.well-known/agent-card.json instead.
curl -s localhost:8080/.well-known/ucp
Find a product.
curl -s -X POST $API/ucp/catalog/search -H "$JSON" -d '{"query":"tee"}'
The response lists demo-tee with "price_minor":2500. Money is always an integer in minor units, so 2500 is 25.00 USD.
Create a cart. Cart operations all go through one command endpoint:
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"create_cart","merchant_id":"demo","currency":"USD"},"cart_id":null}'
The response is the cart, at "version":1. Copy its cart_id and use it in place of <cart_id> from here on.
Add two T-shirts.
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"add_item","item_id":"demo-tee","quantity":2},"cart_id":"<cart_id>"}'
Adding the item priced the line, computed tax and checked geography against the mock providers. The cart is now at "version":2 with "subtotal_minor":5000, "tax_minor":500 and "total_minor":5500.
Start checkout. This locks the cart at the version you saw, so it cannot change under you:
curl -s -X POST $API/cart/commands -H "$JSON" \
-d '{"command":{"kind":"start_checkout","cart_id":"<cart_id>","cart_version":2},"cart_id":"<cart_id>"}'
The cart moves to "status":"checkout_ready" at "version":3.
Pay. The payment intent states the amount the agent expects to pay, and it must equal the cart total:
curl -s -X POST $API/checkout/execute -H "$JSON" \
-d '{"tenant_id":"dev","merchant_id":"demo","cart_id":"<cart_id>","cart_version":3,"currency":"USD",
"payment_intent":{"amount_minor":5500,"token_or_reference":"tok_demo"},"idempotency_key":"demo-1"}'
The response is the transaction: "status":"completed", "payment_state":"captured", a receipt and an order_id.
Two things to try, both described in the architecture page:
- Pay the wrong amount. Send
"amount_minor":5400with a newidempotency_keyand checkout is refused with"code":"AMOUNT_MISMATCH"before any payment call. - Send the same request again. The same
idempotency_keyreturns the originaltransaction_idinstead of charging twice.
5. Try the other protocols
List the MCP tools. The same operations are available to MCP clients as tools:
curl -s -X POST localhost:8080/api/v1/mcp/message \
-H 'content-type: application/json' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Get the REST contract. The full REST API is published as OpenAPI 3.1:
curl -s localhost:8080/api/v1/openapi.json
6. Run the tests
cargo test --workspace
This runs the unit, integration and protocol conformance suites, all against mocks. Tests that need PostgreSQL skip themselves unless DATABASE_URL is set.
Where to go next
| You want to… | Read |
|---|---|
| Understand how it works inside | Architecture |
| Connect your catalog, pricing, tax, geo, payment and receipt services | Plug and deploy and the provider API |
| Call every endpoint, with request and response shapes | Consumption guide |
| Connect an MCP client | MCP binding |
| Check what each protocol covers | Conformance matrix |
| Decide whether it fits your case | FAQ |
FAQ
What is the Commerce Orchestrator?
An open-source Rust service that sits between AI agents and your existing commerce backends. Agents talk to it over the agentic commerce protocols (UCP, ACP, A2A, MCP, AP2, MPP). It talks to your catalog, pricing, tax, geo, payment and receipt services over plain HTTP. In between it runs one cart and checkout model with idempotency, amount and geo checks, signed messages, retries and an outbox.
You deploy it next to your platform. Your backends do not change and do not need an SDK.
What is it not?
- Not a storefront or a commerce platform. It holds no product catalog, prices or tax rules of its own. Those stay in your systems; it calls them.
- Not a payment processor. It authorizes, captures, voids and refunds through your payment provider. Checkout carries a payment token or reference, and the provider does the money movement.
- Not an agent. It does not decide what to buy. It is the merchant side that agents buy from.
- Not a library you embed. The supported integration is the HTTP service. The consumer example shows the in-process facade, but the HTTP API is the contract.
Which protocols does it support?
| Protocol | Version |
|---|---|
| UCP (Universal Commerce Protocol) | 2026-08-25, with older profiles served through supported_versions |
| ACP (Agentic Commerce Protocol) | 2026-04-17 |
| A2A (Agent2Agent) | 1.0, with 0.3 envelopes accepted |
| MCP (Model Context Protocol) | 2026-07-28, plus 2025-11-25 and 2024-11-05 |
| AP2 (Agent Payments Protocol) | 0.2 |
| MPP (Machine Payments Protocol) | draft-httpauth-payment-01 |
| HTTP Message Signatures | RFC 9421 with RFC 9530 Content-Digest |
| Web Bot Auth | draft-ietf-webbotauth-httpsig-protocol-01 |
Coverage is not all-or-nothing. The conformance matrix lists every requirement of each protocol as supported, optional or not supported yet, with the test that proves each supported row.
How does it compare with implementing each protocol myself?
Each protocol brings its own discovery document, message shapes, error model, signature scheme and versioning, and several of them revise every few months. Building them into your platform means doing that work once per protocol and again for every revision, inside the system that also takes your money.
With the orchestrator:
- One integration. You implement six small HTTP endpoints once (see the provider API). Every protocol reaches them through the same cart and checkout model.
- One place for money rules. Idempotency keys, the amount the agent expects to pay, the geo verdict and the cart version are enforced in one code path for every protocol, instead of once per protocol.
- Spec tracking is in the open. Protocol versions, schema checks and conformance tests live in this repository and run in CI on every change.
Building it yourself is the better choice when you only need one protocol, have no plans to add others, and want it inside an existing service rather than as a separate deployment.
Do I need to change my backends?
Usually not much. Each backend needs to expose the endpoints in the provider API: for example POST /tax/resolve returning { "total_tax_minor": 160 }. If your services have different shapes, put a thin adapter in front of them. Every provider can use bearer tokens, API keys, OAuth 2.0 client credentials or mutual TLS.
Is it production ready?
What is in place:
- PostgreSQL persistence with migrations, required when
ENV=production. - Production startup fails closed: without a database, API authentication, signing keys and all six backend URLs, the server refuses to start.
- Idempotent checkout, amount and geo integrity checks, tenant isolation, retries with circuit breakers, an outbox with dead-letter replay, and payment reconciliation.
- Prometheus metrics, a Grafana dashboard, Kubernetes manifests with HPA, PDB and NetworkPolicy, and runbooks.
- CI runs formatting, Clippy with warnings denied, the full test suite, protocol conformance tests, a live PostgreSQL job, a Docker smoke test and a dependency advisory audit.
What to weigh:
- It is pre-1.0 (
0.13.0). Minor versions can change behaviour; the changelog says what changed and how to upgrade. - Releases are source-only. Nothing is published to crates.io; you build from a pinned tag, or build the Docker image from the
Dockerfile. - Some protocol features are not implemented yet, such as ACP’s MCP transport binding. The conformance matrix has the full list.
Run your own staging validation before taking real orders. Plug and deploy ends with a checklist for it.
Does it store personal or payment data?
It stores carts, orders, idempotency results and outbox messages in your database. A checkout can carry a customer email and name and a shipping address, and those are part of the cart and are forwarded to your backends. Logs redact PII. Payment data is whatever token or reference your payment provider issued; the orchestrator passes it to that provider. See SECURITY.md.
Can it run more than one replica?
Yes, with PostgreSQL. Idempotency claims, outbox claims (FOR UPDATE SKIP LOCKED), inbox dedupe and orders all live in the database, so replicas coordinate through it. The Kubernetes manifests include an HPA.
How is it licensed?
Dual-licensed under MIT or Apache-2.0, at your option. You can run it commercially, modify it and keep your modifications private.
How do I report a bug or a security issue?
Open an issue on GitHub. Report security issues privately, as described in SECURITY.md.
Architecture
The orchestrator is a single Rust service. Agents and apps call it over one of several protocols; it maps every protocol onto one cart and checkout model, runs that model through a deterministic state machine, and calls your existing backends over plain HTTP.
This page explains how the pieces fit together. For the HTTP surface see the consumption guide; for the calls it makes to your backends see the provider API.
Crates
The workspace is split so that the domain model has no I/O, the runtime has no HTTP, and every protocol shim sits at the edge.
flowchart TB
http["orchestrator-http<br/>axum server, routes, auth,<br/>RFC 9421 signing, MPP 402"]
mcp["orchestrator-mcp<br/>MCP JSON-RPC tool server"]
api["orchestrator-api<br/>facade, authz, AP2 checks,<br/>UCP and ACP mapping, signing keys"]
runtime["orchestrator-runtime<br/>runner, idempotency, outbox,<br/>dead-letter, inbox, persistence"]
core["orchestrator-core<br/>domain types, state machines,<br/>policy, validation"]
contracts["provider-contracts<br/>provider traits"]
adapters["integration-adapters<br/>HTTP clients for your backends"]
mocks["provider-mocks<br/>in-memory providers for dev and tests"]
obs["orchestrator-observability<br/>tracing, Prometheus metrics"]
http --> mcp
http --> api
mcp --> api
api --> runtime
runtime --> core
runtime --> contracts
contracts --> core
adapters --> contracts
mocks --> contracts
http --> adapters
http --> mocks
http -.-> obs
runtime -.-> obs
adapters -.-> obs
| Crate | Role |
|---|---|
orchestrator-core | Domain types (CartProjection, CheckoutRequest, TransactionResult), the cart and checkout state machines, the policy engine (maximum totals, blocked geographies, payment constraints) and request validation. Pure logic, no I/O. |
provider-contracts | The traits a backend implements: CatalogProvider, PricingProvider, TaxProvider, GeoProvider, PaymentProvider, ReceiptProvider, plus optional fulfillment, payment delegation and identity linking. |
integration-adapters | HTTP implementations of those traits. Shared client with timeouts, retries, circuit breakers, outbound auth (bearer, API key, OAuth 2.0 client credentials) and mTLS. |
provider-mocks | Deterministic in-memory providers. Development mode and the test suite run on these. |
orchestrator-runtime | The Runner: cart command dispatch, checkout execution, idempotency, inventory reservations, orders, the outbox and its background processor, dead-letter, inbox dedupe, webhooks and reconciliation. Store traits with in-memory, file-backed and PostgreSQL implementations. |
orchestrator-api | OrchestratorFacade, the one entry point every transport calls. Tenant-scoped authorization, AP2 mandate verification, UCP and ACP mapping, signing keys and HTTP message signature primitives, PII redaction. |
orchestrator-mcp | MCP tool definitions and the JSON-RPC handler, mapped onto the facade. |
orchestrator-http | The orchestrator-server binary: axum routes for REST, UCP, ACP, A2A and MCP, discovery documents, authentication, signature middleware, Web Bot Auth, the MPP 402 challenge flow, config loading and the OpenAPI document. |
orchestrator-observability | Tracing setup and the metrics helpers every crate uses. |
Request flow
Every transport ends in the same facade call, so a cart created over UCP can be checked out over A2A and behaves the same way.
sequenceDiagram
autonumber
participant Agent
participant HTTP as orchestrator-http
participant Facade as OrchestratorFacade
participant Runner
participant Providers as Your backends
Agent->>HTTP: POST /api/v1/... (UCP, ACP, A2A, MCP or REST)
HTTP->>HTTP: Authenticate (bearer or JWT) and resolve tenant
HTTP->>HTTP: Verify RFC 9421 signature and Content-Digest (when agent keys are configured)
HTTP->>Facade: Protocol shape mapped to a CartCommand or CheckoutRequest
Facade->>Facade: Authorize for the tenant, verify AP2 mandate (strict mode)
Facade->>Runner: dispatch_cart_command / execute_checkout
Runner->>Providers: catalog, pricing, tax, geo, payment, receipt
Providers-->>Runner: results
Runner-->>Facade: CartProjection or TransactionResult
Facade-->>HTTP: domain result
HTTP-->>Agent: protocol response, signed when signing keys are configured
Tenancy always comes from the authenticated caller, never from the request body. A cart remembers its owning tenant, and a caller authenticated for another tenant cannot read or check it out.
Cart lifecycle
Each cart mutation (add, update or remove an item, apply a code, select fulfillment) bumps the cart version and recalculates the cart against your backends in a fixed order: catalog lookup for a new item, pricing, tax, discounts, then the geo check. Each step appends an event to the cart’s event stream and advances the cart state machine.
stateDiagram-v2
[*] --> CartCreated
CartCreated --> ItemsMutated: item changed
ItemsMutated --> ItemsMutated: item changed
ItemsMutated --> Repriced: pricing resolved
Repriced --> Retaxed: tax resolved
Retaxed --> GeoChecked: geo validated
GeoChecked --> ItemsMutated: item changed
GeoChecked --> CheckoutReady: start checkout
CheckoutReady --> ItemsMutated: item changed
CartCreated --> CheckoutReady: start checkout
ItemsMutated --> CheckoutReady: start checkout
Repriced --> CheckoutReady: start checkout
Retaxed --> CheckoutReady: start checkout
CartCreated --> Cancelled: cancel
ItemsMutated --> Cancelled: cancel
Repriced --> Cancelled: cancel
Retaxed --> Cancelled: cancel
GeoChecked --> Cancelled: cancel
CheckoutReady --> Cancelled: cancel
Cancelled --> [*]
Any transition not drawn here is rejected. The state machine lives in orchestrator-core (next_cart_state) and has no side effects, so it is tested exhaustively on its own.
Checkout
Checkout is where money moves, so it re-reads everything instead of trusting the cart snapshot.
flowchart TD
A[Checkout request] --> B{Valid request?}
B -- no --> X1[400 validation error]
B -- yes --> C{Claim idempotency key<br/>tenant + merchant + key}
C -- completed before --> R1[Return the stored result]
C -- in flight --> X2[409 already in flight]
C -- claimed --> D{Cart owned by caller's tenant<br/>and version matches?}
D -- no --> X3[Release key, return error]
D -- yes --> E[Reprice: pricing, tax, discounts]
E --> F{Geo provider allows it?}
F -- no --> X4[Release key, GEO_BLOCKED]
F -- yes --> G{Payment amount equals<br/>the repriced total?}
G -- no --> X5[Release key, AMOUNT_MISMATCH]
G -- yes --> H[Reserve inventory]
H --> I{Policy engine allows it?}
I -- no --> R2[Rejected result, stored]
I -- yes --> J[Authorize payment<br/>Idempotency-Key forwarded]
J -- declined --> R3[AuthFailed result, stored]
J -- 3DS2 required --> P[Pause: AuthenticationRequired<br/>stored under the key]
P -. result from provider or agent .-> Q{Authenticated and<br/>cart unchanged?}
Q -- no --> R3
Q -- yes --> J2[Authorize with the result]
J2 -- declined --> R3
J2 -- authorized --> K
J -- authorized --> K[Commit, capture payment]
K --> L[Create order]
L --> M[Generate receipt]
M --> N[Enqueue order.created in the outbox]
N --> R4[Completed result, stored under the key]
The checkout state machine (next_checkout_state) walks Received → Validated → Priced → Taxed → GeoChecked → PaymentAuthorized → Committed → ReceiptGenerated → Completed, with the terminal failures Rejected, AuthFailed, CommitFailed and TimedOut. Each terminal state maps to the status of the TransactionResult.
stateDiagram-v2
[*] --> Received
Received --> Validated
Validated --> Priced
Priced --> Taxed
Taxed --> GeoChecked
GeoChecked --> PaymentAuthorized: authorized
GeoChecked --> AuthenticationPending: provider asks for 3DS2
AuthenticationPending --> PaymentAuthorized: authenticated, then authorized
AuthenticationPending --> AuthFailed: denied, declined or cart changed
AuthenticationPending --> TimedOut: not finished in time
GeoChecked --> AuthFailed: declined
PaymentAuthorized --> Committed
PaymentAuthorized --> CommitFailed
Committed --> ReceiptGenerated
ReceiptGenerated --> Completed
Received --> Rejected
Validated --> Rejected
Priced --> Rejected
Completed --> [*]
AuthenticationPending is the one state a checkout can stop in without finishing: the payment provider asked for 3DS2 step-up (see conformance: payment authentication). Its status is AuthenticationRequired, and the checkout’s request and pause are kept in the checkout_authentication store (and the cart’s event stream) until the result arrives. Reading the checkout asks the provider for the result; an ACP agent can also submit it. Either way the checkout resumes once, from the stored request.
Three checks guard the money:
- Amount integrity. The agent states the amount it expects to pay. If the repriced total differs, checkout fails with
AMOUNT_MISMATCHbefore any payment call, so a stale cart is never charged a different amount. - Geo is binding. The geo verdict is taken again at checkout, from the cart’s own destination, and a blocked destination stops the checkout.
- Version check. The request names the cart version it saw. A cart that changed since then fails with a version conflict.
Idempotency
Checkout is keyed on (tenant_id, merchant_id, idempotency_key).
- The first request claims the key and marks it in flight. A concurrent duplicate gets a conflict instead of a second charge.
- When the checkout reaches a result (completed, rejected or declined), the result is stored under the key. Replays return that stored result without calling any backend.
- A checkout paused for 3DS2 stores the pause under the key, so a replay returns the same pending step-up. When it resumes, the final result replaces the pause under the same key. The resume itself is claimed under
<key>#authentication, so two replicas reading the checkout at once cannot both place the order. - If checkout fails before anything was charged (validation, version conflict, geo block, amount mismatch), the key is released, so the caller can fix the request and retry with the same key.
- The key is forwarded to your payment provider as the
Idempotency-Keyheader on authorize, capture, void and refund, so a retry inside the orchestrator cannot double-charge either.
With PostgreSQL persistence the claim is a row in the database, so it holds across replicas.
Outbox, dead-letter and inbox
Side effects that leave the system, such as webhooks to subscribers, never happen inline with checkout. Checkout writes an order.created message to the outbox in the same flow that records the order, and a background processor delivers it.
flowchart LR
CO[Checkout completes] --> OB[(Outbox)]
OB --> P[Outbox processor<br/>claim, deliver]
P -- delivered --> ACK[Ack, remove]
P -- failed, attempts left --> BO[Back off, release] --> OB
P -- attempts exhausted --> DL[(Dead-letter)]
DL -- POST /api/v1/ops/dead-letter/replay --> OB
WH[Incoming event] --> IN{Inbox:<br/>seen message id?}
IN -- new --> ACC[Accept]
IN -- duplicate --> IGN[Ignore]
- Claim, then ack. The processor claims a message rather than removing it, and acknowledges it only once it is delivered or dead-lettered. A process that dies mid-delivery costs a retry, not the event. On PostgreSQL the claim uses
FOR UPDATE SKIP LOCKED, so every replica can run the processor. - Backoff. Failed deliveries back off exponentially, so a down endpoint does not burn the whole attempt budget in milliseconds.
- Dead-letter. After the maximum attempts the message moves to the dead-letter store. Operators list it and replay it, which resets the attempt count. See dead-letter handling and retries and outbox.
- Inbox.
POST /api/v1/events/incomingaccepts an event id at most once, so a provider that redelivers a webhook does not apply it twice. - Webhooks. Subscribers register per tenant and only receive their own tenant’s events. Deliveries are signed (RFC 9421) when signing keys are configured.
Persistence
All stores sit behind traits in orchestrator-runtime, with three implementations:
| Backend | When | Use it for |
|---|---|---|
| In-memory | Default in development | Tests, demos, local work |
| File-backed (JSON) | PERSISTENCE_PATH set in development | A local instance that must survive restarts |
| PostgreSQL | DATABASE_URL set, required with ENV=production | Production and anything with more than one replica |
The PostgreSQL schema is applied by orchestrator-server --migrate, which the Kubernetes manifests run as a Job before rollout.
Signing and verification
The orchestrator implements HTTP Message Signatures (RFC 9421) with Content-Digest (RFC 9530), as UCP requires.
- Inbound. When agent public keys are configured (
UCP_AGENT_KEYSorUCP_AGENT_JWKS), every/api/v1request must carrySignature-InputandSignatureheaders that verify against one of them, and a matchingContent-Digestwhen it has a body. - Outbound. When a signing key is configured (
UCP_SIGNING_KEY_ID,UCP_SIGNING_KEY), every response is signed over@statusand its body digest, and so is every webhook delivery. - Keys. Ed25519 or ES256. Public keys are published in the UCP business profile at
/.well-known/ucp. Previous keys stay verifiable bykidduring rotation (UCP_SIGNING_PREVIOUS_KEYS). - Agent identity. Web Bot Auth can additionally identify the agent operator from a signed request.
AP2 mandates and MPP payment credentials are verified separately, on checkout: AP2 in the facade (AP2_STRICT=1 fails closed), MPP through a 402 challenge bound to the request’s amount and body digest. Details are in the consumption guide.
Observability
Every provider call, checkout step, outbox delivery and signature check records Prometheus metrics through orchestrator-observability, labelled by outcome. The metrics are served at /metrics, and a Grafana dashboard ships in deploy/grafana. Logs are structured tracing output with PII redacted.
Consumer integration: REST API
Integrate with the Commerce Orchestrator by calling its deployed HTTP service. No library dependency in your app; use any HTTP client and the JSON API.
Integration surface
Deploy the orchestrator as an HTTP service (orchestrator-server). Your app (Agent, backend, or other clients) calls REST endpoints under /api/v1. The service runs the orchestration logic and routes to your catalog, pricing, tax, geo, payment, and receipt APIs via its own configuration (see Config reference and deploy/README.md).
Endpoints
| Area | Endpoints |
|---|---|
| Discovery | GET /.well-known/ucp (UCP 2026-08-25 business profile with keys[] and payment_handlers; ACP/MCP/A2A/AP2 metadata under the top-level orchestrator member) |
| Cart & checkout | POST /api/v1/cart/commands, /api/v1/ucp/cart and /api/v1/ucp/checkout routes, POST /api/v1/checkout/execute, POST /api/v1/a2a/cart, POST /api/v1/a2a/checkout |
| ACP | /api/v1/acp/checkout_sessions (+ complete/cancel), POST /api/v1/acp/delegate_payment — require API-Version: 2026-04-17 |
| Catalog & orders | GET /api/v1/catalog/items/:id, /api/v1/ucp/catalog routes, GET /api/v1/orders/:id, GET /api/v1/ucp/orders/:id |
| Identity linking | POST /api/v1/a2a/identity/link (A2A-Version: 1.0 or 0.3) |
| A2A 1.0 | GET /.well-known/agent-card.json, POST /api/v1/a2a/message:send, POST /api/v1/a2a/message:stream (SSE), POST /api/v1/a2a/jsonrpc (JSON-RPC, including UCP’s A2A checkout binding) |
| Payments | POST /api/v1/payments/capture, void, refund; GET /api/v1/ucp/payment-handlers |
| MCP | POST /api/v1/mcp/message (dual-era: 2026-07-28 + legacy initialize) |
| Events | POST /api/v1/events/incoming (idempotent ingest) |
| Operations | POST /api/v1/ops/outbox/process, GET /api/v1/ops/dead-letter, POST /api/v1/ops/dead-letter/replay, POST /api/v1/ops/reconciliation |
| Health | GET /health/live, GET /health/ready, GET /metrics |
In production the service requires a Bearer token; send Authorization: Bearer <token> on every request. The token is the value configured as AUTH_BEARER_TOKEN on the server.
Do not modify this repository
- Do not fork to change orchestrator behavior. Consume the deployed API; fixes and features belong upstream.
- Pin to a released tag (e.g.
v0.11.0) for the deployment you use. Upgrade using release notes andCHANGELOG.md.
Summary
| You do | You do not |
|---|---|
| Call the deployed REST API with HTTP + JSON | Fork or patch this repo |
| Configure the orchestrator service to point at your catalog (and other backends) via its env/config | Implement provider code in your app; the service owns adapters |
| Send Bearer token when the service is in production mode | Call without auth in production |
For request/response shapes, error handling, and deployment, see Consumption guide (REST API) and deploy/README.md.
Consumption guide: REST API only
Integrate with the Commerce Orchestrator by calling its deployed HTTP service. No library dependency is required; use any HTTP client and the JSON request/response shapes below.
See consumer-integration.md for the high-level integration model.
Base URL and auth
- Base URL: The orchestrator service URL (e.g.
https://orchestrator.example.com). - Prefix: All API routes are under
/api/v1. - Auth (production): When the service is run with
ENV=production, auth mode is controlled byAUTH_MODE:AUTH_MODE=static: send a fixed bearer token (AUTH_BEARER_TOKEN).AUTH_MODE=jwt: send a signed JWT bearer token (AUTH_JWT_HS256_SECRETused for verification). In both modes, protected endpoints return401 Unauthorizedon missing/invalid credentials.
Authorization: Bearer <your-token>
Message signing (UCP, RFC 9421)
Bearer auth answers who is calling; message signing answers was this exact message altered. The two are independent — a signed request still needs its Authorization header.
Signatures follow RFC 9421 HTTP Message Signatures with an RFC 9530 Content-Digest, as the UCP signatures specification requires. Ed25519 (EdDSA) and ECDSA P-256 (ES256) keys are supported in both directions. ES256 is the one algorithm every UCP verifier must accept, so operators whose counterparties are unknown should prefer it (UCP_SIGNING_KEY_ALG=ES256). The algorithm is always derived from the key named by keyid, never from the message.
sequenceDiagram
participant A as Agent / platform
participant O as Orchestrator
A->>O: GET /.well-known/ucp (unsigned)
O-->>A: profile + public JWKs
A->>O: POST /api/v1/... with Content-Digest, Signature-Input, Signature
O->>O: digest matches body, required components covered, keyid known, signature valid
O-->>A: response with Content-Digest, Signature-Input, Signature over @status
Verifying our responses
When the deployment is configured with UCP_SIGNING_KEY_ID and UCP_SIGNING_KEY (mandatory in production), every response carries:
Content-Digest: sha-256=:<base64 SHA-256 of the body>:
Signature-Input: sig1=("@status" "content-digest" "content-type");created=1760000000;keyid="orch-2026-a"
Signature: sig1=:<base64 signature>:
Bodyless responses cover only "@status". Rebuild the RFC 9421 signature base from those components and verify it with the JWK whose kid matches keyid, fetched from the keys[] JWK Set of /.well-known/ucp (kty: OKP/crv: Ed25519, or kty: EC/crv: P-256). A deployment with no signing material advertises no keys and sets no dev.ucp.security.signatures capability flag — there is no default key, so an unsigned deployment is honest about being unsigned rather than publishing a key everybody shares.
Signing your requests
If the operator has configured your public key (UCP_AGENT_JWKS as a JWK Set, or UCP_AGENT_KEYS as Ed25519 kid:x pairs), every /api/v1 request must be signed; unsigned calls get 401. Discovery and health endpoints stay open, because you must read discovery before you can sign anything.
Use the label sig1 and cover at least:
| Component | When |
|---|---|
"@method", "@authority", "@path" | Always |
"@query" | The request has a query string |
"content-digest", "content-type" | The request has a body (send a matching Content-Digest) |
"idempotency-key", "ucp-agent", "signature-agent" | That header is present |
POST /api/v1/ucp/cart HTTP/1.1
Host: orchestrator.example.com
Content-Type: application/json
Content-Digest: sha-256=:<base64 SHA-256 of the body>:
Signature-Input: sig1=("@method" "@authority" "@path" "content-digest" "content-type");created=1760000000;keyid="agent-1"
Signature: sig1=:<base64 signature>:
created is optional, but when present it must be within 300 seconds of the orchestrator’s clock; expires, when present, must not have passed. Replay protection otherwise comes from idempotency keys. A request may carry several signatures (for example one added by a proxy); it is accepted when any one of them verifies.
Rotation
Both directions are keyed by kid. To rotate ours, set the new key as UCP_SIGNING_KEY_ID/UCP_SIGNING_KEY and list the old one in UCP_SIGNING_PREVIOUS_KEYS (kid:seed, or kid:ES256:secret); both appear in discovery until you drop the old entry. To rotate yours, ask the operator to list both keys, switch, then have the old one removed.
Signature errors
Codes follow the UCP signatures specification:
| HTTP | Code | Meaning |
|---|---|---|
| 401 | signature_missing | No Signature-Input/Signature on a deployment that requires them. |
| 401 | signature_invalid | Verification failed, a required component is not covered, created is outside the 300s window, expires has passed, or a header is malformed. The error text says which. |
| 401 | key_not_found | The keyid is not configured on this deployment. |
| 400 | digest_mismatch | The body does not match the sha-256 Content-Digest, or the digest is missing. |
| 400 | algorithm_unsupported | An alg parameter disagrees with the key’s algorithm. |
Endpoints
Discovery (UCP-style)
| Method | Path | Description |
|---|---|---|
GET | /.well-known/ucp | UCP 2026-08-25 business profile: ucp.services (rest, mcp and, when configured, embedded transports for dev.ucp.shopping), ucp.capabilities, ucp.payment_handlers, the keys[] JWK Set, and an orchestrator member with the MCP endpoint, ACP discovery URL, neighbouring protocol versions and feature flags. ucp.supported_versions links ?ucp_version=2026-04-08 (previous shape) and the 2026-01-23 / 2026-01-11 legacy manifests. Cached public, max-age=300. No auth required. |
GET | /.well-known/acp.json | ACP discovery document: protocol (name/version/supported_versions), api_base_url, transports (rest, mcp), and capabilities.services (checkout, carts, delegate_payment). No auth required. |
Cart and checkout
| Method | Path | Description |
|---|---|---|
POST | /api/v1/cart/commands | Dispatch a cart command (create, add item, update qty, remove item, apply adjustment, get cart, start checkout). Body: CartCommandRequest (see request shapes). |
POST | /api/v1/ucp/carts | UCP REST binding: cart create with line_items; returns a UCP cart envelope. /api/v1/ucp/cart is the older alias. |
GET | /api/v1/ucp/carts/:id | UCP cart lookup (alias /ucp/cart/:id). |
PUT | /api/v1/ucp/carts/:id | UCP cart line replacement/update (alias /ucp/cart/:id). |
POST | /api/v1/ucp/carts/:id/cancel | UCP cart cancellation (alias /ucp/cart/:id/cancel). |
POST | /api/v1/ucp/cart/:id/fulfillment | UCP fulfillment extension (dev.ucp.shopping.fulfillment): quote shipping/pickup options for a destination, or select one. Returns the UCP cart envelope with fulfillment and fulfillment_minor. |
POST | /api/v1/ucp/checkout-sessions | UCP REST binding: checkout session create. The envelope’s root capability is dev.ucp.shopping.checkout. /api/v1/ucp/checkout is the older alias. |
GET | /api/v1/ucp/checkout-sessions/:id | UCP checkout session lookup (alias /ucp/checkout/:id). |
PUT | /api/v1/ucp/checkout-sessions/:id | UCP checkout session line update (alias /ucp/checkout/:id). |
POST | /api/v1/ucp/checkout-sessions/:id/complete | Complete UCP checkout (execute checkout) (alias /ucp/checkout/:id/complete). May answer status: authentication_required; see 3DS2 step-up. |
POST | /api/v1/ucp/checkout-sessions/:id/cancel | Cancel UCP checkout session (alias /ucp/checkout/:id/cancel). |
POST | /api/v1/ucp/checkout/:id/embedded-link | UCP embedded transport: returns a short-lived handoff URL (embedded_url, checkout_session_id, expires_at) on the merchant’s hosted page (EMBEDDED_CHECKOUT_URL). The token query parameter is an Ed25519 signature over ucp-embedded-checkout:{session}:{expires}, verifiable with the discovery JWK named by kid. 404 if the checkout does not exist; 501 NOT_CONFIGURED when no hosted page or signing key is configured. |
POST | /api/v1/ucp/checkout/:id/fulfillment | UCP fulfillment extension for a checkout session; same request/response shape as the cart fulfillment endpoint. |
GET | /api/v1/ucp/payment-handlers | List configured payment handlers. |
GET | /api/v1/ucp/payment-handlers/:id | Get a payment handler by id. |
POST | /api/v1/acp/checkout_sessions | ACP create checkout session: CheckoutSessionCreateRequest in, 201 CheckoutSession out. Requires API-Version: 2026-04-17 and Idempotency-Key. See ACP REST bodies. |
GET | /api/v1/acp/checkout_sessions/:id | ACP get checkout session. |
POST | /api/v1/acp/checkout_sessions/:id | ACP update checkout session (CheckoutSessionUpdateRequest; line_items replace the items). Requires Idempotency-Key. PUT is accepted too. |
POST | /api/v1/acp/checkout_sessions/:id/complete | ACP complete session: CheckoutSessionCompleteRequest in, CheckoutSessionWithOrder out (or the session with status: authentication_required; send authentication_result to finish, see 3DS2 step-up). Requires Idempotency-Key. |
POST | /api/v1/acp/checkout_sessions/:id/cancel | ACP cancel session, optional CancelSessionRequest body; 405 if already canceled. Requires Idempotency-Key. |
POST | /api/v1/acp/delegate_payment | ACP delegate payment token exchange, performed by the configured PSP. Requires Idempotency-Key. Returns 501 NOT_CONFIGURED when no delegation adapter is configured. |
POST | /api/v1/acp/carts | ACP Cart capability: CartCreateRequest in, 201 Cart out, priced in UCP_CATALOG_CURRENCY. Requires API-Version: 2026-04-17 and Idempotency-Key. |
GET | /api/v1/acp/carts/:id | ACP get cart; a canceled cart is 404 not_found. |
PUT | /api/v1/acp/carts/:id | ACP replace cart contents (CartUpdateRequest). Requires Idempotency-Key. |
POST | /api/v1/acp/carts/:id/cancel | ACP cancel cart. Requires Idempotency-Key. |
POST | /api/v1/checkout/execute | Execute checkout for a cart. Body: CheckoutRequestDto. Requires auth in production. |
POST | /api/v1/a2a/message:send | A2A 1.0 SendMessage (HTTP+JSON binding, A2A-Version: 1.0 required). See A2A 1.0. |
GET/POST | /api/v1/a2a/tasks/:id, /api/v1/a2a/tasks/:id:cancel | A2A task operations; always 404 TASK_NOT_FOUND, because this agent replies with messages and never creates tasks. |
POST | /api/v1/a2a/checkout | A2A envelope checkout. Send A2A-Version: 1.0 (or 0.3). |
POST | /api/v1/a2a/cart | A2A envelope cart command. Send A2A-Version: 1.0 (or 0.3). |
POST | /api/v1/a2a/identity/link | A2A envelope: { "capability": "dev.ucp.common.identity_linking", "payload": { "tenant_id": "...", "merchant_id": "...", "agent_id": "...", "link_token": "...", "user_reference": "..."? } }. Legacy identity capability names remain accepted. Returns 501 NOT_CONFIGURED when no identity provider is configured. |
Catalog and orders
| Method | Path | Description |
|---|---|---|
GET | /api/v1/catalog/items/:id | Legacy catalog item lookup. |
POST | /api/v1/ucp/catalog/search | UCP-native catalog search. Body: { "query": "..." }. |
POST | /api/v1/ucp/catalog/lookup | UCP-native batch lookup. Body: { "ids": ["SKU-1"] }; misses are returned as UCP messages. |
POST | /api/v1/ucp/catalog/product | UCP-native product lookup. Body: { "id": "SKU-1" }. |
GET | /api/v1/orders/:id | Legacy order lookup with tenant isolation. |
GET | /api/v1/ucp/orders/:id | UCP order: checkout_id, currency, permalink_url, line_items[] (with quantity: {original, total, fulfilled} and status), fulfillment, and totals[]. |
Payments
| Method | Path | Description |
|---|---|---|
POST | /api/v1/payments/capture | Capture an authorized payment. Body: PaymentLifecycleRequestDto. Tenant in body must match auth context. |
POST | /api/v1/payments/void | Void a payment. Body: PaymentLifecycleRequestDto. |
POST | /api/v1/payments/refund | Refund a payment. Body: PaymentLifecycleRequestDto. |
Events and operations
| Method | Path | Description |
|---|---|---|
POST | /api/v1/events/incoming | Idempotent event ingest (e.g. webhooks). Body: { "message_id": "..." }. |
POST | /api/v1/ops/outbox/process | Process one outbox message. Body: { "max_attempts": 3 }. |
GET | /api/v1/ops/dead-letter | List dead-letter entries. |
POST | /api/v1/ops/dead-letter/replay | Replay a message from dead-letter. Body: { "message_id": "..." }. |
POST | /api/v1/ops/reconciliation | Run payment reconciliation. Body: { "transaction_ids": ["..."] }. |
GET | /api/v1/openapi.json | OpenAPI 3.1 document for REST clients and tooling. No auth required. |
Health and metrics
| Method | Path | Description |
|---|---|---|
GET | /health/live | Liveness probe. |
GET | /health/ready | Readiness probe. |
GET | /metrics | Prometheus text metrics including orchestrator_events_total, provider call counts, and provider latency histograms. |
Request and response shapes
All request/response bodies are JSON.
Cart command (POST /api/v1/cart/commands)
Request: { "command": { "kind": "<command_kind>", ... }, "cart_id": "<uuid or null>" }
A cart belongs to the tenant that created it, taken from your access token and
not from the request body. Reading, changing, cancelling, starting checkout on, or
checking out a cart that belongs to another tenant returns 403 with
code: TENANT_MISMATCH — a cart id on its own grants nothing. This applies to
every surface: REST, UCP, ACP, A2A and the MCP tools.
Command kinds and their fields:
create_cart:merchant_id,currencyadd_item:item_id,quantityupdate_item_qty:line_id,quantityremove_item:line_idapply_adjustment:codeget_cart:cart_idstart_checkout:cart_id,cart_versioncancel_cart:cart_id
Response (success): Cart projection with cart_id, version, currency, lines, subtotal_minor, tax_minor, fulfillment_minor, discount_minor, discounts, total_minor, geo_ok, status.
Discounts (apply_adjustment)
An apply_adjustment code is stored on the cart and re-evaluated by your pricing
provider on every reprice, via PricingProvider::resolve_discounts. The provider
decides what a code is worth; the orchestrator never invents a discount.
- The provider returns zero or more discounts, each with
code, optionaldescription,amount_minorand optionalline_id. - Returning an error rejects the code, and the
apply_adjustmentcommand fails with apricingerror. Use this for expired or ineligible campaigns. discount_minoris the sum of granted discounts, clamped so thattotal_minorcan never go below zero.total_minor = subtotal_minor + tax_minor + fulfillment_minor - discount_minor.- Because codes are re-evaluated on every reprice, a discount that stops being valid after a cart change disappears from the next projection.
A provider that does not implement resolve_discounts grants nothing, so codes
are accepted and recorded but change no money. UCP cart responses carry
discount_minor plus a discounts array, and advertise dev.ucp.shopping.discount
when at least one discount applies; ACP session and cart totals[] carry a discount entry.
Checkout execute (POST /api/v1/checkout/execute)
Request: CheckoutRequestDto — tenant_id, merchant_id, cart_id, cart_version, currency, optional customer, optional location, payment_intent (e.g. amount_minor, token_or_reference), idempotency_key.
MPP note:
- For machine payments, set
payment_intent.payment_method_typetompp. - Include
payment_intent.mpp_method(a lowercase method name, for examplestripeortempo) andpayment_intent.mpp_intent(for examplecharge). - Do not mix AP2 fields (
ap2_consent_proof,payment_handler_id) withpayment_method_type = mpp. - When the operator has not set
MPP_CHALLENGE_SECRET, put the credential inpayment_intent.token_or_reference. The payment provider gets it as sent.
MPP Payment challenges
With MPP_CHALLENGE_SECRET set, an MPP checkout is paid through the Payment HTTP authentication scheme (draft-httpauth-payment):
-
Send the checkout without a credential. The answer is
402 Payment RequiredwithCache-Control: no-store, an RFC 9457 problem body (type: https://paymentauth.org/problems/payment-required), and a challenge:WWW-Authenticate: Payment id="…", realm="shop.example.com", method="tempo", intent="charge", request="<base64url JSON>", expires="2026-11-26T12:05:00Z", digest="sha-256=:…:", header="Payment-Authorization", opaque="…"requestdecodes to{"amount": "<amount_minor>", "currency": "<lowercase ISO 4217>"}.digestis the RFC 9530Content-Digestof the exact body you sent.idis an HMAC over every other parameter, so none of them can be edited.
-
Pay, then resend the same body. Send the byte-identical body with
Payment-Authorization: Payment <base64url JSON>. The JSON is{ "challenge": { …the parameters echoed… }, "payload": { …method-specific proof… }, "source": "…" }, as the draft defines. The credential goes inPayment-AuthorizationbecauseAuthorizationalready carries your API bearer token. -
The orchestrator checks the credential. The challenge must be bound by this deployment, unexpired, issued for this body, and unused. The orchestrator then claims its
idonce and hands the credential to your payment provider astoken_or_reference. The provider verifies the method-specific proof. -
On success, you get
200with the transaction result,Cache-Control: private, andPayment-Receipt: <base64url JSON>(status,method,timestamp,reference,challengeId).
Refusals are 402 with a fresh challenge and one of these problem types:
Problem type (under https://paymentauth.org/problems/) | Cause |
|---|---|
malformed-credential | The credential is not base64url JSON of the draft’s shape. |
invalid-challenge | The challenge was not issued by this deployment for this body, its parameters were edited, or its id was already used. |
payment-expired | The challenge’s expires has passed. |
verification-failed | The payment provider did not accept the proof. |
Sending more than one Payment-Authorization header is 400 (bad-request). Authentication runs first, so a bad bearer token is 401 and the credential is not consumed.
sequenceDiagram
participant Agent
participant Orchestrator
participant PSP as Payment provider
Agent->>Orchestrator: POST /checkout/execute (payment_method_type=mpp)
Orchestrator-->>Agent: 402 WWW-Authenticate: Payment (bound to body, amount, expiry)
Agent->>Agent: pay with the method, build credential
Agent->>Orchestrator: same body + Payment-Authorization: Payment …
Orchestrator->>Orchestrator: verify binding, expiry and digest, then claim the id once
Orchestrator->>PSP: authorize (credential as token_or_reference)
alt proof accepted
Orchestrator-->>Agent: 200 + Payment-Receipt
else proof refused
Orchestrator-->>Agent: 402 verification-failed + fresh challenge
end
MPP over MCP
The native MCP server (POST /api/v1/mcp/message) runs the same flow for the execute_checkout tool, in the MPP MCP transport’s JSON form, whenever MPP_CHALLENGE_SECRET is set:
- Without a credential the call fails with JSON-RPC error
-32042(Payment Required).error.data.challenges[0]is the challenge as a JSON object,error.data.problemthe RFC 9457 problem. The challenge has noheaderparameter, and itsdigestcovers the JCS-canonical toolargumentsinstead of an HTTP body. - Retry with the same
argumentsand the credential object (not base64url) inparams._meta["org.paymentauth/credential"]. - On success the transaction result carries
_meta["org.paymentauth/receipt"]with the same fields asPayment-Receipt. - Refusals are
-32042with a fresh challenge and the problem types above; a proof your payment provider refuses is-32043.
The MCP binding has the full wire shapes. MPP is not available on the UCP, ACP or A2A checkout bindings: none of those specifications defines an MPP handler, instrument or message part (conformance matrix).
Response (success): Transaction result with transaction_id, status, totals_breakdown, payment_reference, receipt_payload, correlation_id, payment_state, order_id.
Amount integrity
Before anything is authorized, the orchestrator re-runs pricing, tax and discount resolution against your providers and refreshes the cart snapshot. The refreshed total — not the total the cart happened to be carrying — is what may be charged.
payment_intent.amount_minormust equal that total exactly. Anything else is refused with422and codeAMOUNT_MISMATCH; the message states the amount the cart actually costs.- A rejected request does not consume its
idempotency_key, so the caller can immediately retry with the corrected amount under the same key. - A stale price is therefore caught at checkout rather than silently under-collected. Re-read the cart (
get_cart) to see the refreshed totals;cart_versionis unchanged because the cart’s contents did not change.
sequenceDiagram
participant Agent
participant Orchestrator
participant Providers as Pricing / Tax
Agent->>Orchestrator: POST /checkout/execute (amount_minor)
Orchestrator->>Providers: re-price, re-tax, re-discount
Providers-->>Orchestrator: current total
alt amount_minor == current total
Orchestrator->>Orchestrator: authorize and capture
Orchestrator-->>Agent: 200 transaction result
else mismatch
Orchestrator-->>Agent: 422 AMOUNT_MISMATCH (idempotency key released)
end
ACP REST bodies (2026-04-17)
/api/v1/acp/checkout_sessions and /api/v1/acp/carts take and return the ACP 2026-04-17 bodies exactly; requests are validated against the official ACP JSON Schema and anything outside it (including the orchestrator’s earlier merchant_id, tenant_id and amount_minor fields) is 400 invalid_payload. The same code serves the ACP MCP binding.
POST /api/v1/acp/checkout_sessions
API-Version: 2026-04-17
Idempotency-Key: 7f3c...
{ "currency": "usd", "line_items": [{ "id": "demo-tee" }, { "id": "demo-tee" }], "capabilities": {} }
- Items. ACP items carry no quantity: each
line_items[]entry is one unit, so the example is one line withquantity: 2. - Merchant and tenant. ACP bodies name neither: the session belongs to the authenticated caller’s tenant and to
UCP_DEFAULT_MERCHANT_ID(400 merchant_requiredwhen unset). - Responses. A
CheckoutSessionwithprotocol.version,capabilities,status(ready_for_paymentwith items,not_ready_for_paymentwithout,canceled),line_items[](item.id,quantity,unit_amount,totals[]),totals[](subtotal,discount,fulfillment,tax,total),fulfillment_options,messagesandlinks. - Complete. Send
payment_data.handler_idandpayment_data.instrument.credential.token, optionalbuyer. The amount is the session’s total, the idempotency key is theIdempotency-Keyheader, and the answer isCheckoutSessionWithOrder(status: completed,order { id, checkout_session_id, permalink_url }). The same key replays the same order; a key spent on another session is422 idempotency_conflict. - Carts.
CartCreateRequest/CartUpdateRequestholdline_items(and optionalbuyer); aCarthasid,currency(UCP_CATALOG_CURRENCY;400 currency_requiredwhen unset),line_itemsandtotals. A canceled cart is gone (404), since ACP carts have no status. - Errors. Every failure is an ACP
Error:{ "type": "invalid_request", "code": "session_not_found", "message": "...", "param": "$.id" }. Codes:missing_api_version/unsupported_api_version(withsupported_versions),idempotency_key_required,invalid_json,invalid_payload(with a JSONPathparam),merchant_required,currency_required,session_not_found/not_found(404),forbidden(403, another tenant’s session),session_not_cancelable(405),idempotency_conflict(422),payment_declined(402,processing_error),unsupported_payment_method. - Headers. The
Idempotency-Keyis echoed on success.
MCP transport rules (all MCP endpoints)
POST /api/v1/mcp/message, POST /api/v1/ucp/mcp and POST /api/v1/acp/mcp follow MCP 2026-07-28 Streamable HTTP. A client on 2026-07-28 sends MCP-Protocol-Version: 2026-07-28, Mcp-Method (the body’s method) on every request and Mcp-Name (the tool name, or the resource URI) on tools/call and resources/read; a missing or different value is HTTP 400 with JSON-RPC -32020, an unsupported version 400 with -32022, an unknown method 404 with -32601. Clients on 2025-11-25 or 2024-11-05 (or sending no version header) are served as before. A request carrying an Origin header is refused with 403 unless that origin is listed in MCP_ALLOWED_ORIGINS; server-side agents send no Origin and are unaffected. GET and DELETE are 405. See MCP binding.
UCP MCP binding (POST /api/v1/ucp/mcp)
UCP platforms that use MCP (UCP’s services/shopping/mcp.openrpc.json) call the checkout, cart, catalog and order operations as MCP tools at POST /api/v1/ucp/mcp, listed in /.well-known/ucp as the mcp transport of dev.ucp.shopping. The tools run the same code as the REST binding and return the same UCP bodies, in result.structuredContent. Each call carries arguments.meta["ucp-agent"].profile; complete_checkout, cancel_checkout and cancel_cart also need a UUID meta["idempotency-key"]. See MCP binding for tools, errors and metrics.
3DS2 step-up (UCP actions and ACP delegate authentication)
When the payment provider wants the buyer authenticated with 3DS2 before it authorizes, the checkout pauses instead of failing. Nothing is charged until the authentication result is known, and the idempotency key keeps answering with the pending step-up. This only happens when the deployment’s payment provider supports it, which discovery says: dev.ucp.common.payment.authentication in /.well-known/ucp, capabilities.intervention_types: ["3ds"] in /.well-known/acp.json. Test it in development with the mock tokens tok_3ds_challenge (challenge, then authenticated), tok_3ds_device_data (device data collection, then authenticated), tok_3ds_pending (never finishes) and tok_3ds_denied.
UCP (REST, MCP and A2A). complete_checkout (MCP and A2A) returns the checkout with status: complete_in_progress and an action; REST complete returns status: authentication_required and payment_state: authentication_pending with an authentication object, and Get Checkout shows the same UCP checkout:
{
"status": "complete_in_progress",
"actions": {
"dev.ucp.common.payment.three_ds_challenge": [
{ "id": "three_ds_challenge-3ds_...", "config": { "payment_instrument_id": "pi_card_1", "url": "https://psp.example/3ds/..." } }
]
},
"payment": { "instruments": [ { "id": "pi_card_1", "handler_id": "card", "type": "card", "selected": true } ] }
}
Open config.url in the surface the extension describes (invisible for device_data_collection, buyer-facing for three_ds_challenge). After action.done, call Get Checkout (GET /api/v1/ucp/checkout-sessions/:id or get_checkout): it asks the provider for the result and answers completed with the order, or keeps complete_in_progress while the provider is still waiting, or returns the cart status with a payment_failed message if authentication failed. Do not call complete again while it is in progress. To point the action at your instrument over REST, send payment_instrument_id in the complete body. When the deployment negotiates platform profiles (UCP_PROFILE_NEGOTIATION lenient or strict), declare dev.ucp.common.payment.authentication (extending dev.ucp.shopping.checkout) in your profile: without it the actions are withheld and the checkout answers with a recoverable payment_failed message instead, so complete again with another instrument.
ACP (REST and MCP). Complete Checkout Session returns the CheckoutSession with status: authentication_required, authentication_metadata (acquirer_details, directory_server) and a requires_3ds message, and Retrieve shows the same. Run delegate authentication with your authentication provider, then complete again (new Idempotency-Key, or a new meta.idempotency_key over MCP) with the result:
{
"payment_data": {
"handler_id": "card_tokenized",
"instrument": { "type": "card", "credential": { "type": "spt", "token": "spt_..." } }
},
"authentication_result": {
"outcome": "authenticated",
"outcome_details": { "three_ds_cryptogram": "AAAB...", "electronic_commerce_indicator": "05", "transaction_id": "...", "version": "2.2.0" }
}
}
Only authenticated and attempt_acknowledged lead to an order (completed, with order); other outcomes answer 402 payment_declined, and Retrieve then shows a payment_declined message. outcome_details is required for authenticated, attempt_acknowledged and informational (400 invalid_payload otherwise). Sending a result when nothing is pending is 409 authentication_not_pending. Repeating the result returns the same outcome.
A pause expires after 15 minutes (timed_out). A cart changed while the buyer authenticates is not charged (auth_failed).
Platform profile negotiation (UCP-Agent)
UCP platforms name their own profile on every request: the UCP-Agent header on the REST binding, and meta["ucp-agent"].profile on the MCP binding.
POST /api/v1/ucp/checkout-sessions
UCP-Agent: profile="https://platform.example/profiles/shopping-agent.json"
The header is an RFC 8941 dictionary; only its profile string is read. What the orchestrator does with it depends on UCP_PROFILE_NEGOTIATION:
| Mode | Behaviour |
|---|---|
off (default) | Nothing is fetched. Responses list every capability the operation uses, as before. The MCP binding still requires an http(s) profile URL. |
lenient | The profile is fetched and negotiated. When that works, responses list only negotiated capabilities. When it fails (no header, unreachable, malformed, unsupported version, operation outside the intersection), the failure is counted and the request proceeds unnegotiated. Use it to see what strict would refuse before you switch. |
strict | UCP 2026-08-25 behaviour: every failure refuses the request with the errors below. |
sequenceDiagram
participant P as UCP platform
participant O as Orchestrator
participant PP as Platform profile host
P->>O: request + UCP-Agent profile URL
alt profile cached (60 s to 1 h)
O->>O: reuse cached profile
else
O->>PP: GET profile (HTTPS, public address, no redirects, 5 s, 256 KiB)
PP-->>O: profile + Cache-Control max-age
end
O->>O: check ucp.version, intersect capabilities
O-->>P: response whose ucp.capabilities lists only negotiated capabilities
Version. The platform’s ucp.version must be 2026-08-25 or one of the older versions in our profile’s supported_versions (2026-04-08, 2026-01-23, 2026-01-11). Capabilities match only at equal versions, and this deployment serves its capabilities at 2026-08-25, so a platform must list 2026-08-25 capability versions to negotiate any.
Intersection. A capability is negotiated when both profiles declare it with a common version; the highest common version is used. Extensions (discount, fulfillment) are dropped when none of the capabilities they extend survived, repeatedly until nothing changes. An operation whose own capability (checkout, cart, order, catalog.search, catalog.lookup) is not negotiated gets a capabilities_incompatible error in strict mode.
Errors (strict):
| Situation | REST | MCP |
|---|---|---|
No UCP-Agent header, malformed header, URL not HTTPS, or a host resolving to a private or special-use address | 400 {"code":"invalid_profile_url","content":"..."} | HTTP 400, -32001, data.code: invalid_profile_url |
Profile cannot be fetched (DNS, connect, timeout, non-200, redirect) | 424, profile_unreachable | HTTP 424, -32001 |
Profile is not a platform profile (ucp.version, ucp.services, ucp.payment_handlers required) or too large | 422, profile_malformed | HTTP 422, -32001 |
Platform’s ucp.version not supported | 422, version_unsupported | HTTP 422, -32001 |
| The operation’s capability is not in the intersection | 200 with a UCP error response: ucp.status: error, messages[0].code: capabilities_incompatible | Result with the same UCP error response |
Caching. A profile is reused for its Cache-Control: max-age, at least 60 s and at most 1 h; a failed fetch is retried after 15 s. Up to 256 profile URLs are cached per replica.
Fetch safety. Profile URLs come from callers, so the fetch accepts only https URLs without credentials or fragments, resolves the host once and refuses loopback, private, link-local (including 169.254.169.254), CGNAT, documentation, multicast and other special-use addresses, then connects only to the checked addresses. It follows no redirects, uses no proxy, times out after 3 s (connect) / 5 s (total), and stops reading at 256 KiB. Requests that fail authentication never cause a fetch. The pod needs egress on port 443 to platforms’ profile hosts (the shipped NetworkPolicy allows it).
Metrics. orchestrator_operation_calls_total / orchestrator_operation_latency_seconds with operation="ucp_negotiation_rest" or "ucp_negotiation_mcp" and status = negotiated, invalid_profile_url, profile_unreachable, profile_malformed or version_unsupported; operation="ucp_profile_fetch" with status = success, invalid_url, prohibited_address, unreachable, http_status, too_large (fetch latency); counters ucp_negotiation_total, ucp_profile_cache_hit_total, ucp_profile_cache_miss_total, ucp_negotiation_capabilities_incompatible_total and ucp_negotiation_lenient_bypass_total.
ACP MCP binding (POST /api/v1/acp/mcp)
ACP agents that use MCP (ACP 2026-04-17 openrpc.agentic_checkout.json) call create_checkout_session, get_checkout_session, update_checkout_session, complete_checkout_session and cancel_checkout_session at POST /api/v1/acp/mcp; /.well-known/acp.json lists the mcp transport, and the URL is given out of band. Arguments are meta (api_version required, idempotency_key for complete, optional merchant_id), id and payload (the ACP 2026-04-17 request body, validated against the ACP schema). Results are ACP CheckoutSession objects; errors are JSON-RPC -32000 with the ACP Error in data. Sessions are shared with the REST binding. See MCP binding.
Completed and canceled checkouts
A checkout that placed its order is final, and so is a canceled one. Reading it back answers completed with the order (UCP order.id / permalink_url; ACP order on the CheckoutSession) or canceled. Changing it is refused on every binding:
| Binding | Completed | Canceled |
|---|---|---|
| UCP REST (update, cancel, complete) | 409 CHECKOUT_COMPLETED | 409 CART_CANCELED |
UCP MCP and A2A (incl. add_to_checkout) | error response, checkout_completed, severity: unrecoverable | cart_canceled, unrecoverable |
| ACP REST and MCP (update, complete) | 409 checkout_session_completed | 409 checkout_session_canceled |
| ACP cancel | 405 session_not_cancelable | 405 session_not_cancelable |
A retry of the original complete with its own idempotency key still replays the outcome. Start a new checkout to buy again.
UCP response bodies
Cart, checkout session, and order bodies validate against the UCP 2026-08-25 schemas (shopping/cart.json, shopping/checkout.json, shopping/order.json):
line_items[]:item: { id, title, price }(unit price in minor units),quantity, andtotals[].title,unit_price_minorandtotal_minorremain on cart and checkout lines as aliases.totals[]: typed integer amounts in minor units — exactly onesubtotaland onetotal, plusdiscount(negative, only when something was taken off),fulfillment(when a paid option is selected) andtax. The*_minorfields remain as aliases.- Checkout
status:incomplete(empty or not yet started),ready_for_complete,complete_in_progress(paused for 3DS2, withactions),completed(after a 3DS2 checkout finished, withorder), orcanceled. Checkout responses also carrylinks[]and the deployment’sucp.payment_handlers. Cart responses keep the orchestrator’sdraft/checkout_ready/canceled. - Orders:
checkout_idnames the checkout session; each line hasquantity: { original, total, fulfilled }andstatus(processing,fulfilled, orremovedfor a cancelled order);fulfillmentis present with emptyexpectations/events(order history is inevents).
Fulfillment selection (POST /api/v1/ucp/cart/:id/fulfillment)
Request: method_type (shipping or pickup), destination, optional line_item_ids (defaults to all lines), optional selected_option_id.
- Shipping destination:
{ "id": "dest_1", "street_address": "...", "address_locality": "...", "address_region": "...", "address_country": "...", "postal_code": "..." }. - Pickup (retail) destination:
{ "id": "dest_1", "name": "<store name>" }.
Calling without selected_option_id returns quoted options for the method type without changing total_minor. Calling again with selected_option_id set to one of the quoted option ids selects it, adds its amount_minor to total_minor via fulfillment_minor, and replaces any prior selection for that method type.
The selected destination is also the location your geo provider sees. Setting or
changing a destination re-runs the geo check immediately, and every later reprice
passes the cart’s destination country, region and postal code — along with the
cart’s tenant and merchant — so a blocked destination shows up as geo_ok: false
rather than passing unnoticed.
The verdict is binding. execute_checkout re-takes it and refuses a blocked
destination with 403 and code: GEO_BLOCKED; nothing is authorized and the
cart keeps geo_ok: false.
{
"method_type": "shipping",
"destination": {
"id": "dest_1",
"street_address": "1 Market St",
"address_locality": "San Francisco",
"address_region": "CA",
"address_country": "US",
"postal_code": "94105"
},
"selected_option_id": "express"
}
Response (success): UCP cart envelope whose fulfillment object follows the UCP 2026-08-25 fulfillment schema: each method carries destinations[] (type: shipping_address with the postal fields, or type: business_location with name and optional address) and selected_destination_id; each option carries title, description: { "plain": … }, and totals: [{ "type": "total", "amount": <minor units> }] (plus amount_minor, an orchestrator alias of the same amount); groups[].selected_option_id is set once selected. Selecting an option id that was not part of the quoted set returns an error rather than a silent no-op.
"fulfillment": {
"methods": [{
"id": "shipping", "type": "shipping", "line_item_ids": ["line_1"],
"destinations": [{ "type": "shipping_address", "id": "dest_1", "postal_code": "94105", "address_country": "US" }],
"selected_destination_id": "dest_1",
"groups": [{
"id": "group_1", "line_item_ids": ["line_1"], "selected_option_id": "express",
"options": [{ "id": "express", "title": "Express Shipping",
"description": { "plain": "Arrives in 2-3 business days" },
"totals": [{ "type": "total", "amount": 1000 }], "amount_minor": 1000 }]
}]
}]
}
A2A 1.0: Agent Card and SendMessage
GET /.well-known/agent-card.json (public, cacheable) is the A2A 1.0 Agent Card. It lists three interfaces — {base}/api/v1/a2a (HTTP+JSON, 1.0) and {base}/api/v1/a2a/jsonrpc (JSONRPC, 1.0 and 0.3) — capabilities.streaming: true, the UCP extension (see UCP’s A2A binding), and the skills this deployment can run: cart, checkout, order-lookup, ucp-checkout, and identity-linking when an identity provider is configured. When the deployment requires bearer auth, the card says so in securitySchemes/securityRequirements. /.well-known/ucp links it as orchestrator.a2a_agent_card.
POST /api/v1/a2a/message:send carries one of the existing capability envelopes in a DataPart and answers synchronously with an agent Message whose DataPart holds the result (the same body the matching /a2a/* route returns). Which skill runs is read from the envelope: an identity capability links identity, payload.order_id looks up an order, payload.command runs a cart command, anything else is a checkout. Pass contextId to thread several messages; a new one is assigned otherwise.
sequenceDiagram
participant C as A2A client
participant O as Orchestrator
C->>O: GET /.well-known/agent-card.json
O-->>C: AgentCard (HTTP+JSON interface, skills)
C->>O: POST /api/v1/a2a/message:send (A2A-Version: 1.0, DataPart envelope)
O->>O: same normalizer, authz, idempotency as /a2a/* routes
O-->>C: {"message": {"role": "ROLE_AGENT", "parts": [{"data": result}]}}
POST /api/v1/a2a/message:send HTTP/1.1
A2A-Version: 1.0
Content-Type: application/a2a+json
Authorization: Bearer <token>
{"message": {"messageId": "msg-1", "role": "ROLE_USER", "contextId": "ctx-7",
"parts": [{"mediaType": "application/json", "data": {
"capability": "dev.ucp.shopping.checkout",
"payload": {"command": {"kind": "create_cart", "merchant_id": "m1", "currency": "USD"}}}}]}}
Errors use A2A’s google.rpc.Status shape, {"error": {"code", "status", "message", "details": [{"@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason", "domain"}]}}:
| HTTP | reason | When |
|---|---|---|
| 400 | VERSION_NOT_SUPPORTED | A2A-Version is missing (A2A reads that as 0.3) or not 1.0 |
| 400 | INVALID_PARAMS | Not JSON, no messageId, role not ROLE_USER, or no DataPart |
| 400 | UNSUPPORTED_OPERATION | An operation other than message:send / message:stream, or GET /extendedAgentCard |
| 400 | PUSH_NOTIFICATION_NOT_SUPPORTED | Any /tasks/{id}/pushNotificationConfigs operation |
| 404 | TASK_NOT_FOUND | GetTask, CancelTask, SubscribeToTask, or a message that names a taskId |
| 4xx/5xx | orchestrator code (e.g. NOT_FOUND, AMOUNT_MISMATCH), domain commerce-orchestrator | The operation itself failed; the HTTP status matches the REST route |
GET /api/v1/a2a/tasks (ListTasks) is always empty: the agent never creates tasks. Push notifications, the extended card, the gRPC binding and Agent Card signatures are not offered; the card says so.
Streaming (SendStreamingMessage)
POST /api/v1/a2a/message:stream takes the same request as message:send and answers text/event-stream. Because the agent replies with a Message, the stream holds exactly one event and then closes, as A2A 1.0 §3.1.2 requires:
HTTP/1.1 200 OK
Content-Type: text/event-stream
data: {"message":{"messageId":"…","contextId":"ctx-7","role":"ROLE_AGENT","parts":[{"data":{…},"mediaType":"application/json"}]}}
Errors (wrong version, bad message, a failed operation) are found before the stream opens and come back as the ordinary application/a2a+json error above, never as an event. Each stream is counted in the orchestrator_open_streams{stream="a2a_message_stream"} gauge while it is open.
JSON-RPC binding
POST /api/v1/a2a/jsonrpc takes one JSON-RPC 2.0 request per POST:
- With
A2A-Version: 1.0:SendMessage(result{"message": …}),SendStreamingMessage(one SSE event whosedatais a full JSON-RPC response),GetTask/CancelTask/SubscribeToTask(-32001),ListTasks(empty), the push config methods (-32003) andGetExtendedAgentCard(-32004). - With no
A2A-Version(A2A 0.3):message/sendandmessage/streamwith 0.3 messages ("kind": "message","role": "user", parts{"kind": "data", "data": …}), andtasks/get/tasks/cancel(-32001).
A 1.0 method without A2A-Version: 1.0 is -32009; an unknown method -32601; a bad message -32602. Refusals (401, 403, 409) keep their HTTP status; other errors come back in a 200, with error.data.reason and error.data.domain as in the HTTP+JSON ErrorInfo.
UCP’s A2A binding (checkout)
UCP platforms that speak A2A drive checkout with UCP’s own message shapes (specification/shopping/checkout/a2a). /.well-known/ucp lists the binding as {"transport": "a2a", "endpoint": "{base}/.well-known/agent-card.json"} under dev.ucp.shopping, and the Agent Card advertises the extension https://ucp.dev/2026-08-25/specification/reference with params.capabilities["dev.ucp.shopping.checkout"].
Send every request with UCP-Agent: profile="https://…" (required) and X-A2A-Extensions (or A2A-Extensions) naming the extension URI, which is echoed back. A message is UCP when a DataPart has an action or a2a.ucp.* keys; anything else is the orchestrator’s own envelope as above. The binding is written against JSON-RPC message/send, which the JSON-RPC endpoint serves when no A2A-Version is sent; the same DataParts also work over HTTP+JSON and JSON-RPC SendMessage with A2A-Version: 1.0.
action | DataPart fields | Does |
|---|---|---|
add_to_checkout | product_id, quantity (default 1), optional currency, merchant_id | Adds the product to the context’s checkout, or starts one |
create_checkout | a2a.ucp.checkout: {currency, line_items[], merchant_id?} | New checkout |
get_checkout | — | Reads the context’s checkout |
update_checkout | a2a.ucp.checkout | Replaces the line items |
cancel_checkout | — | Cancels; cancelling again returns the cancelled checkout |
complete_checkout | a2a.ucp.checkout.payment (an instrument, or {instruments: [...]}), optional a2a.ucp.checkout.signals, optional a2a.ucp.checkout: {buyer} | Pays and places the order; the checkout comes back completed with order {id, permalink_url} |
The reply’s DataPart holds the checkout under a2a.ucp.checkout, and its contextId is the checkout id: send it back for the next turn. A checkout made over REST or MCP is driven over A2A by sending its id as the contextId (or as id in the DataPart), and an A2A checkout reads back over the others. add_to_checkout carries no merchant or currency, so configure UCP_DEFAULT_MERCHANT_ID and UCP_CATALOG_CURRENCY (or send merchant_id / currency).
sequenceDiagram
participant P as UCP platform
participant O as Orchestrator
P->>O: GET /.well-known/ucp
O-->>P: dev.ucp.shopping a2a → agent card URL
P->>O: message/send {action: add_to_checkout, product_id, quantity} (UCP-Agent, X-A2A-Extensions)
O->>O: run_ucp_create_checkout (same code as REST and MCP)
O-->>P: message {contextId: checkout id, data: {a2a.ucp.checkout}}
P->>O: message/send contextId, {action: complete_checkout} + {a2a.ucp.checkout.payment}
O->>O: run_ucp_complete_checkout
O-->>P: a2a.ucp.checkout {status: completed, order {id, permalink_url}}
{"jsonrpc": "2.0", "id": 3, "method": "message/send", "params": {"message": {
"role": "user", "kind": "message", "messageId": "e94a8c10-69f4-4c4c-b988-21a298302da6",
"contextId": "<checkout id>",
"parts": [
{"kind": "data", "data": {"action": "complete_checkout"}},
{"kind": "data", "data": {
"a2a.ucp.checkout.payment": {"id": "instr_1", "handler_id": "card", "type": "card",
"credential": {"type": "token", "token": "tok_visa"}},
"a2a.ucp.checkout.signals": {"dev.ucp.buyer_ip": "203.0.113.42"}}}]}}}
- Idempotency:
messageIdis the idempotency key. A retried message is answered with the first reply and not applied again; reusing amessageIdfor a different message is-32000/ HTTP409(IDEMPOTENCY_CONFLICT). Each replica remembers its last 10,000 messages; completion is also guarded by the checkout runner’s durable key. - Business errors (unknown checkout, validation, payment failure) are a normal reply whose
a2a.ucp.checkoutis a UCP error response:{"ucp": {"status": "error"}, "messages": [{"type": "error", "code": "not_found", …}]}. - Protocol errors: missing or invalid
UCP-Agentprofile-32001(data.code: invalid_profile_url); another tenant’s checkout-32000with HTTP403(data.reason: TENANT_MISMATCH); an unknown action or an AP2 mandate (ap2.checkout_mandate, not supported here)-32602. - Cart, catalog and order have no UCP A2A binding; use the REST or MCP bindings.
- Metrics:
orchestrator_operation_calls_total/orchestrator_operation_latency_secondswithoperation="a2a_ucp_<action>".
Identity linking (POST /api/v1/a2a/identity/link)
Request: A2A envelope with capability and payload:
capability:dev.ucp.common.identity_linking(legacydev.ucp.identity.linkingremains accepted)payload:tenant_id,merchant_id,agent_id,link_token, optionaluser_reference
Response (success): { "ucp": { "version": "...", "supported_versions": [...] }, "link_id": "...", "status": "linked" }.
Payment lifecycle (capture / void / refund)
Request: tenant_id, merchant_id, transaction_id, amount_minor, idempotency_key (and any other fields required by the DTO).
Response: { "success": true/false, "reference": "..." }.
Errors
Failed requests return JSON:
{ "error": "<message>", "code": "<CODE>" }
Common codes: BAD_REQUEST, UNAUTHORIZED, FORBIDDEN, NOT_FOUND, VALIDATION_ERROR, IDEMPOTENCY_CONFLICT, PAYMENT_ERROR, AMOUNT_MISMATCH, TENANT_MISMATCH (403, the cart or resource belongs to another tenant), GEO_BLOCKED (403, your geo provider refused the cart’s destination), MERCHANT_REQUIRED (400, a UCP cart or checkout named no merchant_id and UCP_DEFAULT_MERCHANT_ID is unset; ACP answers merchant_required), STORE_ERROR, RUNNER_ERROR, NOT_CONFIGURED (501, the deployment does not offer that capability), PAYMENT_DELEGATION_ERROR (502, the PSP failed). Use the HTTP status code (4xx/5xx) and code for handling.
ACP-specific: ACP checkout session and cart routes answer with ACP Error bodies instead (see ACP REST bodies). Every mutating ACP route (checkout_sessions create/update/complete/cancel, delegate_payment, carts create/update/cancel) requires a non-empty Idempotency-Key header; a missing or blank header returns 400 with code: idempotency_key_required.
Config reference (server-side)
The orchestrator is a middleware API layer. Operators configure where each downstream service lives. In production the server requires all of the following (see deploy/README.md):
| Variable | Description |
|---|---|
ENV | production to enable auth and real adapters. |
PUBLIC_BASE_URL | Public base URL advertised in discovery (e.g. https://orchestrator.example.com). |
DATABASE_URL | PostgreSQL connection string (e.g. postgres://orchestrator:secret@localhost:5432/orchestrator). |
AUTH_MODE | static (default) or jwt. |
AUTH_BEARER_TOKEN | Required when AUTH_MODE=static; clients send Authorization: Bearer <token>. |
AUTH_JWT_HS256_SECRET | Required when AUTH_MODE=jwt; JWT HS256 verification secret. |
CATALOG_BASE_URL | Catalog service base URL (e.g. http://catalog-service:8080). |
PRICING_BASE_URL | Pricing service base URL. |
TAX_BASE_URL | Tax service base URL. |
GEO_BASE_URL | Geo service base URL. |
PAYMENT_BASE_URL | Payment service base URL. |
RECEIPT_BASE_URL | Receipt service base URL. |
UCP_SIGNING_KEY_ID, UCP_SIGNING_KEY | Signing material (Ed25519 seed, or P-256 scalar with UCP_SIGNING_KEY_ALG=ES256); production will not start without them. |
Optional: AUTH_TENANT_ID, AUTH_CALLER_ID (default prod for static mode), AP2_TRUSTED_ISSUERS (comma-separated allowlist for strict AP2 issuer checks and JWT issuer checks), UCP_SIGNING_KEY_ALG, UCP_SIGNING_PREVIOUS_KEYS, UCP_AGENT_KEYS, UCP_AGENT_JWKS, and UCP_PAYMENT_HANDLERS (see Message signing), FULFILLMENT_BASE_URL, PAYMENT_DELEGATION_BASE_URL, IDENTITY_LINK_BASE_URL, EMBEDDED_CHECKOUT_URL, UCP_DEFAULT_MERCHANT_ID (the default merchant for every protocol whose payloads carry none: UCP carts and checkouts without a merchant_id, and ACP checkout sessions and carts, REST and MCP; a request value wins), UCP_CATALOG_CURRENCY (ISO 4217 currency for UCP catalog prices when the request has no context.currency, and for ACP carts) and MCP_ALLOWED_ORIGINS (comma-separated browser origins, or *, allowed to call the MCP endpoints; unset, any request with an Origin header is refused with 403), and UCP_PROFILE_NEGOTIATION (off, lenient or strict; see Platform profile negotiation). Capabilities backed by an optional service are advertised only when that service is configured; the endpoint returns 501 with code: NOT_CONFIGURED otherwise. Config can be loaded from a file (CONFIG_FILE or config.yaml) with env overrides.
AP2 note: this release aligns with AP2 0.2 (closed mandates plus optional open/HNP mandates with amount and currency constraints). Strict mode remains fail-closed.
Next steps
- Deploy the orchestrator using deploy/README.md and configure all six component base URLs so the service can call your catalog, pricing, tax, geo, payment, and receipt APIs.
- In production, set
ENV=production,PUBLIC_BASE_URL,DATABASE_URL, and auth variables for your selectedAUTH_MODE(AUTH_BEARER_TOKENorAUTH_JWT_HS256_SECRET).
Web Bot Auth agent identity
Web Bot Auth is an optional identity layer based on draft-ietf-webbotauth-httpsig-protocol-01, a work-in-progress specification. It identifies an agent operator; customer consent, tenant authorization and payment authority remain separate checks.
Configure server.web_bot_auth_directory_urls as a list of HTTPS key-directory URLs, or set the comma-separated environment override WEB_BOT_AUTH_DIRECTORY_URLS. An empty list disables this layer. With it enabled, all /api/v1/ requests need Web Bot Auth in addition to configured bearer/UCP checks. Discovery and health stay open. Deploy behind HTTPS, configure PUBLIC_BASE_URL, and preserve the public Host and request path at proxies.
Requests carry dictionary-form Signature-Agent, Signature-Input and Signature. Each accepted signature covers its own Signature-Agent dictionary member and either @authority or @target-uri. Its tag is web-bot-auth, its keyid is the JWK SHA-256 thumbprint, and created/expires are required. The local freshness policy permits at most 300 seconds of clock skew. Expired/not-yet-valid keys are rejected. Ed25519 and P-256 are supported. A supplied Content-Digest must match the body. Applications receive WebBotIdentity in request extensions.
Discovery fetches the configured HTTPS URL directly. Redirects, URL credentials, queries in configured URLs, private/special addresses and responses over 64 KiB are rejected. DNS is checked before connecting and pinned for TLS. Proxies are disabled. DNS/connect/read operations have timeouts. Cache lifetime follows max-age capped at 300 seconds; no-store/no-cache are honored. Key removal takes effect after cache expiry. Caches hold at most 64 URLs and each response at most 128 keys. Configure only operator-controlled directory URLs. Unknown URLs fail without an outbound request.
Missing/failed signatures return 403 with Accept-Signature. A valid signature proves control of a key published at the resolved URL; it grants no commerce scopes. Authority-only signatures remain reusable until expiry. For request-specific replay resistance, sign method, path/query, body digest and idempotency key, and use existing commerce idempotency. This layer has no durable nonce registry.
Metrics use orchestrator-observability: web_bot_auth_verified_total, web_bot_auth_rejected_total, and counts/errors/latency for web_bot_auth_verify and web_bot_auth_discovery. Credentials and keys are not logged. RSA, legacy bare-string Signature-Agent, directory redistribution proofs and Signed-Agent-Metadata policy are outside this profile.
MCP binding
The orchestrator speaks Model Context Protocol over a single JSON-RPC 2.0 endpoint, so an agent can drive the whole cart-to-checkout lifecycle as tool calls instead of hand-rolling REST.
POST /api/v1/mcp/message
Everything on this page runs through the same OrchestratorFacade as the REST and A2A surfaces: identical policy, idempotency, provider calls, and metrics. MCP is a transport, not a second implementation.
Transport
| Property | Value |
|---|---|
| Endpoint | POST /api/v1/mcp/message (advertised as orchestrator.mcp_endpoint in /.well-known/ucp; this is the orchestrator’s own tool server. UCP’s MCP binding is at /api/v1/ucp/mcp and ACP’s at /api/v1/acp/mcp, see UCP’s and ACP’s sections) |
| Payload | JSON-RPC 2.0 request object (jsonrpc, id, method, params) |
| Auth | Same as every other API route: Authorization: Bearer <token> |
| Version header | MCP-Protocol-Version |
Request headers (2026-07-28) | Mcp-Method on every request; Mcp-Name on tools/call, resources/read and prompts/get |
| Browser origins | An Origin header, when sent, must be listed in MCP_ALLOWED_ORIGINS |
| Content type | application/json |
GET / DELETE | 405 Method Not Allowed (no SSE stream, no sessions) |
There is no SSE or stdio transport. One request, one response.
Streamable HTTP rules
Every MCP endpoint the orchestrator serves (/api/v1/mcp/message, /api/v1/ucp/mcp, /api/v1/acp/mcp) applies the MCP 2026-07-28 Streamable HTTP rules through one shared check, before authentication and before the endpoint reads the message.
flowchart TD
P[POST] --> O{Origin header?}
O -->|absent| V
O -->|listed in MCP_ALLOWED_ORIGINS| V
O -->|anything else| F["403, JSON-RPC error without id"]
V{MCP-Protocol-Version} -->|unsupported value| U["400, -32022 supported / requested"]
V -->|absent, but _meta names a version| H["400, -32020"]
V -->|absent, 2025-11-25 or 2024-11-05| L[Legacy: served as before]
V -->|2026-07-28| M{"Mcp-Method = body method?<br/>Mcp-Name = params.name / uri?<br/>header = _meta version?"}
M -->|no| H
M -->|yes| D[Dispatch]
D --> R["result: resultType, ttlMs, cacheScope<br/>unknown method: 404, -32601<br/>notification: 202, no body"]
Origin (DNS-rebinding protection). A request without an Origin header is served: agents calling from servers send none, and refusing them would break every non-browser client. A request with an Origin is served only when that origin is listed in MCP_ALLOWED_ORIGINS (comma-separated scheme://host[:port], compared after lower-casing and dropping default ports). The default list is empty, so a web page that gets a browser to call a local or internal deployment is refused with 403. Same-origin is not accepted implicitly: under DNS rebinding the attacker’s page and the Host header carry the same attacker-controlled name, so only an explicit list protects. List the origins of browser-based clients (the MCP Inspector runs at http://localhost:6274), or set MCP_ALLOWED_ORIGINS=* when a gateway in front already enforces an origin policy.
Headers. Under 2026-07-28:
MCP-Protocol-Versionmust be a supported version (else400,-32022, withdata.supportedanddata.requested) and must matchparams._meta["io.modelcontextprotocol/protocolVersion"]when that is present (else400,-32020). A body that names a version in_metawithout sending the header is also400,-32020.Mcp-Methodmust equal the body’smethodon every request.Mcp-Namemust equalparams.namefortools/callandprompts/get, andparams.uriforresources/read. Values in the=?base64?…?=form are decoded before comparing.- A missing or different value is
400with-32020(HeaderMismatch), answering the request’sid. The revision does not define headers for notifications, so a notification is held only to the headers it sends.
Responses. Under 2026-07-28 an unknown method is HTTP 404 with -32601; every result carries resultType: "complete"; server/discover, tools/list and the other list methods carry ttlMs: 300000 and cacheScope: "private" (results depend on the caller’s credentials), and resources/read carries ttlMs: 0. Notifications get 202 with no body. No Mcp-Session-Id is issued, and one sent by a client is ignored.
Back-compat. A request whose MCP-Protocol-Version is 2025-11-25 or 2024-11-05, or that carries no version at all (clients older than 2025-06-18, which the spec lets a server treat as legacy), is served exactly as before: no Mcp-Method/Mcp-Name requirement, unknown methods stay HTTP 200, results are not decorated, and initialize works. Only the Origin check applies to every client.
Authentication and tenancy
The bearer token resolves to an AuthContext (caller, tenant, scopes) before dispatch. Tool arguments never carry tenancy: a tenant_id in a tool call is used for lookups scoped to the caller’s own tenant, never to cross into another one. execute_checkout additionally requires the checkout:execute scope.
Signatures
If the deployment configures agent keys (UCP_AGENT_JWKS or UCP_AGENT_KEYS), requests to /api/v1 — including /api/v1/mcp/message — must carry valid RFC 9421 Signature-Input/Signature headers and a matching Content-Digest, and responses are signed back. See message signing.
Version negotiation
The server is dual-era: it supports the modern discovery handshake and the legacy initialize handshake at once.
| Version | Era | Handshake |
|---|---|---|
2026-07-28 | modern | server/discover, then a version on every request |
2025-11-25 | legacy | initialize |
2024-11-05 | legacy | initialize |
Modern clients declare the version per request, either as the MCP-Protocol-Version header or in params._meta:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list",
"params": {
"_meta": {
"io.modelcontextprotocol/protocolVersion": "2026-07-28",
"io.modelcontextprotocol/clientInfo": { "name": "my-agent", "version": "1.0" }
}
}
}
Rules the server enforces (the header checks are in Streamable HTTP rules):
- If both the header and
_metacarry a version and they disagree, the request is rejected with HTTP400,-32020. - An unsupported version returns HTTP
400,-32022withdata.supportedlisting what is accepted, anddata.requestedechoing what you sent. - Under
2026-07-28, every result carries_metawithio.modelcontextprotocol/serverInfoandio.modelcontextprotocol/protocolVersion. - Under
2026-07-28,initializeis rejected with-32601: callserver/discoverinstead. - A request with no version at all is treated as
2024-11-05for backward compatibility, exceptserver/discover, which implies the modern version.
flowchart TD
R[Request] --> V{Version declared?}
V -->|header or _meta| S{Supported?}
V -->|no, server/discover| M[2026-07-28]
V -->|no, anything else| L[2024-11-05]
S -->|yes| U[Use it]
S -->|no| E["-32022 with supported list"]
U --> C{header vs _meta agree?}
C -->|no| E2["400, -32020"]
C -->|yes| D[Dispatch]
Methods
| Method | Purpose |
|---|---|
server/discover | Modern handshake: supported versions, capabilities, server info |
initialize | Legacy handshake; rejected under 2026-07-28 |
notifications/initialized | Legacy no-op acknowledgement |
tools/list | Tool catalogue with JSON Schema inputs |
tools/call | Invoke a tool by name with arguments |
resources/list | Readable resource URI templates |
resources/read | Read one resource by uri |
Tools
Seventeen tools cover the lifecycle. Every one maps to a facade operation that the REST API also exposes.
Cart
| Tool | Required arguments | Notes |
|---|---|---|
create_cart | merchant_id, currency | Tenancy comes from the bearer token |
add_item | cart_id, item_id, quantity | |
update_item_qty | cart_id, line_id, quantity | |
remove_item | cart_id, line_id | |
apply_adjustment | cart_id, code | Priced by your pricing provider; an unknown code changes nothing |
set_fulfillment_selection | cart_id, method_type, destination | Quotes options, and selects one if selected_option_id is given |
get_cart | cart_id |
Checkout and orders
| Tool | Required arguments |
|---|---|
start_checkout | cart_id, cart_version |
execute_checkout | tenant_id, merchant_id, cart_id, cart_version, currency, payment_intent, idempotency_key |
get_order | order_id |
list_orders | tenant_id |
MPP payments on execute_checkout
With MPP_CHALLENGE_SECRET set, an execute_checkout call whose payment_intent.payment_method_type is mpp is paid through the MPP MCP transport, the JSON-RPC form of the Payment authentication scheme the REST checkout uses (consumption guide):
-
Call without a credential. The answer is HTTP
200with JSON-RPC error-32042Payment Required:{ "jsonrpc": "2.0", "id": 9, "error": { "code": -32042, "message": "Payment Required", "data": { "httpStatus": 402, "challenges": [{ "id": "…", "realm": "shop.example.com", "method": "tempo", "intent": "charge", "request": "<base64url JSON>", "expires": "2026-12-01T12:05:00Z", "digest": "sha-256=:…:", "opaque": "…" }], "problem": { "type": "https://paymentauth.org/problems/payment-required", "title": "Payment Required", "status": 402, "detail": "…" } } } }requestdecodes to{"amount": "<amount_minor>", "currency": "<lowercase ISO 4217>"}.digestis the RFC 9530 digest of the JCS-canonical (RFC 8785)argumentsobject, so the retry must send the same arguments. -
Pay, then call again with the same
argumentsand the credential as a JSON object inparams._meta["org.paymentauth/credential"]:{ "challenge": { …echoed… }, "payload": { …method-specific proof… }, "source": "…" }. -
On success the result is the transaction result with
_meta["org.paymentauth/receipt"]:{ "status": "success", "method", "timestamp", "reference", "challengeId" }. Under2026-07-28it sits beside the server’s own_metakeys.
The credential is checked and claimed exactly as over HTTP, then handed to the payment provider base64url-encoded in token_or_reference, the same bytes a REST Payment-Authorization credential carries. Refusals carry a fresh challenge:
| Code | Problem type (under https://paymentauth.org/problems/) | Cause |
|---|---|---|
-32042 | malformed-credential | The _meta credential is not the draft’s JSON shape |
-32042 | invalid-challenge | Not issued by this deployment for these arguments, edited (amount, realm, …), or already used |
-32042 | payment-expired | The challenge’s expires has passed |
-32043 | verification-failed | The payment provider did not accept the proof (Payment Verification Failed) |
Other tools, other payment methods and deployments without MPP_CHALLENGE_SECRET are not challenged, and a _meta credential sent to them is ignored. server/discover and tools/list do not advertise MPP, because no MPP MCP transport source defines a key for it; the -32042 challenge is the signal. UCP’s and ACP’s MCP bindings do not take MPP: their complete_checkout tools pay through the protocol’s own payment handlers, and neither protocol defines an MPP handler.
sequenceDiagram
participant Agent
participant Orchestrator
participant PSP as Payment provider
Agent->>Orchestrator: tools/call execute_checkout (payment_method_type=mpp)
Orchestrator-->>Agent: error -32042, data.challenges (bound to the arguments)
Agent->>Agent: pay with the method, build credential
Agent->>Orchestrator: same arguments + _meta org.paymentauth/credential
Orchestrator->>Orchestrator: verify binding, expiry and digest, then claim the id once
Orchestrator->>PSP: authorize (credential as token_or_reference)
alt proof accepted
Orchestrator-->>Agent: result + _meta org.paymentauth/receipt
else proof refused
Orchestrator-->>Agent: error -32043 + fresh challenge
end
Payments
capture_payment, void_payment, and refund_payment all take tenant_id, merchant_id, transaction_id, amount_minor, idempotency_key and return { success, reference }.
Catalog
lookup_catalog_item (item_id), lookup_catalog_items (item_ids), and search_catalog_items (optional query).
Fulfillment selection
set_fulfillment_selection covers the UCP dev.ucp.shopping.fulfillment extension. It takes the same flat destination shape as POST /api/v1/ucp/cart/:id/fulfillment, so an agent learns one contract for both transports.
Omit selected_option_id to quote without committing:
{
"jsonrpc": "2.0",
"id": 7,
"method": "tools/call",
"params": {
"name": "set_fulfillment_selection",
"arguments": {
"cart_id": "6f1c…",
"method_type": "shipping",
"destination": {
"id": "dest_1",
"street_address": "1 Market St",
"address_locality": "San Francisco",
"address_region": "CA",
"address_country": "US",
"postal_code": "94105"
}
}
}
}
The result is the cart projection; quoted options live under fulfillment.methods[].groups[].options[], and fulfillment_minor stays 0 until something is selected. Call again with selected_option_id to commit, which adds the option’s amount to the cart total and triggers a reprice and geo re-check against the new destination.
For pickup, send "method_type": "pickup" and include name on the destination for the retail location.
selected_option_id must be an id the merchant actually quoted for this cart. Anything else is an error — an agent cannot invent a shipping price.
Resources
| URI template | Content |
|---|---|
order://{id} | Order as JSON |
cart://{id} | Cart projection as JSON |
resources/read returns contents[0].text holding the JSON document, with mimeType: application/json.
Errors
Tool and dispatch failures come back as JSON-RPC errors with HTTP 200; transport-rule failures carry their own HTTP status.
| HTTP | Code | Meaning |
|---|---|---|
404 (2026-07-28), 200 (legacy) | -32601 | Unknown method, or initialize under 2026-07-28 |
400 | -32020 | A required header (MCP-Protocol-Version, Mcp-Method, Mcp-Name) is missing or disagrees with the body |
400 | -32022 | Unsupported protocol version; data.supported lists what works |
403 | -32600 | Origin not allowed (the error has no id) |
400 | -32700 / -32600 | Body is not JSON / not a JSON-RPC request |
200 | -32603 | Tool failure: unknown tool, missing argument, or a facade error such as a rejected fulfillment option or a failed provider call |
200 | -32042 / -32043 | MPP payment required / payment verification failed on execute_checkout (MPP payments) |
Other transport-level problems (a missing or invalid bearer token, a missing or stale signature) are ordinary HTTP errors and never reach the JSON-RPC layer.
Observability
Every message records orchestrator_operation_calls_total{operation="mcp_tool_call"} and the matching latency histogram, split by success/error, plus a per-tool counter and a counter for the negotiated protocol version. Unsupported version requests increment mcp_version_unsupported_total.
MPP on execute_checkout counts the shared mpp_challenge_issued_total, mpp_receipt_issued_total and mpp_credential_rejected_<problem>_total, and the same counters with an mpp_mcp_ prefix for this transport alone; orchestrator_operation_calls_total{operation="mpp_mcp_credential_check"} and its histogram time the credential check, split by accepted/challenged/error.
Requests refused by the Streamable HTTP rules, on any MCP endpoint, increment mcp_transport_rejected_<reason>_total with reason origin, unsupported_protocol_version or header_mismatch.
MCP registry metadata
server.json at the repository root describes this server in the format of the MCP Registry (schema 2025-12-11), as io.github.AncientiCe/commerce-orchestrator:
- OCI package: the published image
ghcr.io/ancientice/commerce-orchestrator-api, reached athttp://localhost:8080/api/v1/mcp/messageonce it runs. Without configuration it starts in development mode against mock providers. The image carries theio.modelcontextprotocol.server.namelabel the registry uses to check ownership. - Remote:
https://{orchestrator_host}/api/v1/mcp/messagewith a bearer token, because every merchant runs its own deployment and there is no shared hosted endpoint.
The registry lists the transport as streamable-http: one POST, one application/json response, and 405 for GET and DELETE, following the Streamable HTTP rules. The OCI package lists MCP_ALLOWED_ORIGINS for clients that run in a browser.
UCP’s MCP binding
UCP defines its own MCP transport for the shopping service (services/shopping/mcp.openrpc.json). The orchestrator serves it on a separate endpoint:
POST /api/v1/ucp/mcp
It is separate because both servers define create_cart, get_cart and get_order with different arguments. A UCP platform finds it in /.well-known/ucp:
"dev.ucp.shopping": [
{ "version": "2026-08-25", "transport": "rest", "endpoint": "https://orchestrator.example.com/api/v1/ucp", ... },
{
"version": "2026-08-25",
"spec": "https://ucp.dev/2026-08-25/specification/overview",
"transport": "mcp",
"schema": "https://ucp.dev/2026-08-25/services/shopping/mcp.openrpc.json",
"endpoint": "https://orchestrator.example.com/api/v1/ucp/mcp"
}
]
Tools run the same code as the UCP REST binding (/api/v1/ucp/*), so a checkout created over MCP can be read over REST and vice versa. Auth, tenancy and RFC 9421 signatures work as on every other /api/v1 route.
sequenceDiagram
participant Agent as UCP platform (MCP client)
participant MCP as POST /api/v1/ucp/mcp
participant Core as run_ucp_* (shared with REST)
participant Facade as OrchestratorFacade
Agent->>MCP: tools/call create_checkout {meta, checkout}
MCP->>MCP: meta.ucp-agent.profile is a URL?
opt UCP_PROFILE_NEGOTIATION lenient or strict
MCP->>MCP: fetch or reuse platform profile, intersect capabilities
end
MCP->>Core: run_ucp_create_checkout
Core->>Facade: create cart, add lines, start checkout
Facade-->>Core: projection
Core-->>MCP: UCP checkout
MCP-->>Agent: result {structuredContent: checkout, content: [text]}
Agent->>MCP: tools/call complete_checkout {meta + idempotency-key, id, checkout.payment}
MCP->>Facade: execute_checkout (key = idempotency-key)
Facade-->>MCP: transaction + order
MCP-->>Agent: checkout {status: completed, order {id, permalink_url}}
Tools
tools/list is generated from the official OpenRPC file: each tool’s inputSchema is the method’s params (with the meta schema inlined) and its outputSchema is the method’s result schema.
| Tool | Arguments | Result |
|---|---|---|
create_checkout | meta, checkout (currency, line_items[]; optional merchant_id, see below) | Checkout (ready_for_complete when it has lines) |
get_checkout | meta, id | Checkout |
update_checkout | meta, id, checkout (full replacement of line_items[]; lines keep their id) | Checkout |
complete_checkout | meta with idempotency-key, id, checkout.payment.instruments[0] (handler_id, credential.token), optional checkout.buyer | Checkout with status: completed and order { id, permalink_url } |
cancel_checkout | meta with idempotency-key, id | Checkout with status: canceled |
create_cart | meta, cart (currency, line_items[]; optional merchant_id) | Cart |
get_cart | meta, id | Cart |
update_cart | meta, id, cart | Cart |
cancel_cart | meta with idempotency-key, id | Cart with status: canceled |
get_order | meta, id | Order |
search_catalog | meta, catalog (query, optional context.currency) | Search response: products[] |
lookup_catalog | meta, catalog (ids[], optional context.currency) | Lookup response: products[], each variant with inputs[]; ids that match nothing are not_found warnings in messages[] |
get_product | meta, catalog (id, optional context.currency) | product, or a not_found error response |
Merchant. UCP has no merchant field, so a cart or checkout is created for the body’s merchant_id when it has one (an orchestrator extension), else for UCP_DEFAULT_MERCHANT_ID. With neither, the result is a UCP error response with code merchant_required (REST: 400 MERCHANT_REQUIRED).
Catalog currency. Each catalog item becomes a UCP product with one variant whose price is the item’s minor-unit amount. The catalog provider returns no currency, so prices are given in the request’s context.currency when present, else UCP_CATALOG_CURRENCY. With neither, the result is a UCP error response with code currency_required; a context.currency that is not a three-letter code gets invalid_currency. Search filters and pagination are not applied: every match is returned.
Every request carries meta:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "complete_checkout",
"arguments": {
"meta": {
"ucp-agent": { "profile": "https://platform.example/profiles/shopping-agent.json" },
"idempotency-key": "550e8400-e29b-41d4-a716-446655440000"
},
"id": "6d1f3c6e-8a5e-4a43-9a43-6a1d3f1f2b10",
"checkout": {
"payment": {
"instruments": [{
"id": "pi_1", "handler_id": "card", "type": "card",
"credential": { "type": "token", "token": "tok_visa" }
}]
}
}
}
}
}
With UCP_PROFILE_NEGOTIATION set to lenient or strict, the platform profile is fetched (HTTPS only), cached, and negotiated exactly as on the REST binding: the result’s ucp.capabilities lists only capabilities in the intersection. With the default off, the profile URL is checked for shape only and not fetched. See Platform profile negotiation.
Results
A result holds the UCP payload twice: as structuredContent, and serialized as content[0].text for clients without structured content.
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"structuredContent": { "ucp": { "version": "2026-08-25", ... }, "id": "...", "status": "completed", "order": { ... } },
"content": [{ "type": "text", "text": "{\"ucp\":{...},...}" }]
}
}
Idempotency
complete_checkout, cancel_checkout and cancel_cart require meta["idempotency-key"], a UUID.
- Retrying
complete_checkoutwith the same key returns the first outcome; the payment is not taken twice. - Using a key already spent on another checkout is a conflict: HTTP
409,-32000. - Cancelling something already canceled returns it unchanged.
Errors
| Situation | Response |
|---|---|
| Unknown checkout, cart or order | Result; structuredContent is a UCP error response: ucp.status: error, messages[0].code: not_found, severity: unrecoverable |
| Validation or payment failure | Result with a UCP error response, severity: recoverable (payment_failed, validation_error, …) |
meta["ucp-agent"].profile missing or not a URL | HTTP 400, -32001, data.code: invalid_profile_url |
| Negotiation enabled, profile not HTTPS or resolving to a private address | HTTP 400, -32001, data.code: invalid_profile_url (strict only) |
| Negotiation enabled, profile cannot be fetched | HTTP 424, -32001, data.code: profile_unreachable (strict only) |
| Negotiation enabled, profile is not a valid platform profile | HTTP 422, -32001, data.code: profile_malformed (strict only) |
Negotiation enabled, platform’s ucp.version not supported | HTTP 422, -32001, data.code: version_unsupported (strict only) |
| Negotiation enabled, the tool’s capability is not in the intersection | Result; structuredContent is a UCP error response with code: capabilities_incompatible (strict only) |
| Missing argument, missing or non-UUID idempotency key, unknown tool | -32602 |
| No or invalid bearer token | HTTP 401, -32000 |
| Another tenant’s cart, checkout or order | HTTP 403, -32000, data.code: TENANT_MISMATCH (FORBIDDEN for orders) |
| Idempotency key reused for another checkout | HTTP 409, -32000, data.code: IDEMPOTENCY_CONFLICT |
| Server or provider fault | HTTP 5xx, -32603 |
| Unknown method | -32601 (HTTP 404 under 2026-07-28) |
Unsupported MCP-Protocol-Version header | HTTP 400, -32022, data.supported |
Missing or mismatched Mcp-Method, Mcp-Name or version header | HTTP 400, -32020 |
Lifecycle
initialize answers with the requested protocolVersion when it is one of 2026-07-28, 2025-11-25, 2024-11-05 (else 2025-11-25); ping, server/discover, tools/list and tools/call work without it. Notifications such as notifications/initialized get HTTP 202 with no body. Responses are single JSON bodies; there is no SSE stream. The Streamable HTTP rules (Origin, Mcp-Method, Mcp-Name) apply as on the native endpoint.
Metrics
Each tool call records orchestrator_operation_calls_total and orchestrator_operation_latency_seconds with operation="ucp_mcp_<tool>" and status set to success or the error kind (not_found, tenant_mismatch, invalid_params, invalid_profile_url, profile_unreachable, version_unsupported, idempotency_conflict, …). Negotiation itself is recorded as operation="ucp_negotiation_mcp" (see the consumption guide). Counters ucp_mcp_tools_list_total, ucp_mcp_initialize_total, ucp_mcp_idempotency_conflict_total, ucp_mcp_parse_error_total and the shared mcp_transport_rejected_<reason>_total cover the rest. Tool calls also increment the same ucp_cart_* / ucp_checkout_* / ucp_order_* counters as the REST binding.
ACP’s MCP binding
ACP 2026-04-17 defines an MCP transport for checkout (spec/2026-04-17/openrpc/openrpc.agentic_checkout.json, binding). The orchestrator serves it on its own endpoint:
POST /api/v1/acp/mcp
It is separate from the native and UCP servers because ACP has its own error model (every ACP error is -32000 with the ACP Error object in data) and an ACP agent should see exactly the five ACP tools. ACP passes the endpoint URL out of band: /.well-known/acp.json lists "transports": ["rest", "mcp"] but carries no URL, so give agents https://<host>/api/v1/acp/mcp.
The tools run the same run_acp_* code as the ACP REST binding (/api/v1/acp/checkout_sessions, which takes the same 2026-04-17 bodies), so a session created over MCP can be read over REST. Auth, tenancy, RFC 9421 signatures and the Streamable HTTP rules work as on every other MCP endpoint.
sequenceDiagram
participant Agent as ACP agent (MCP client)
participant MCP as POST /api/v1/acp/mcp
participant Core as run_acp_* (shared with REST)
participant Facade as OrchestratorFacade
Agent->>MCP: tools/call create_checkout_session {meta.api_version, payload}
MCP->>MCP: api_version supported? payload valid against the ACP schema?
MCP->>Core: run_acp_create_session
Core->>Facade: create cart, add items
Facade-->>MCP: projection
MCP-->>Agent: result = CheckoutSession (+ structuredContent, content)
Agent->>MCP: tools/call complete_checkout_session {meta.idempotency_key, id, payload.payment_data}
MCP->>Core: run_acp_complete_session (start checkout if draft)
Core->>Facade: execute_checkout (key = idempotency_key)
Facade-->>MCP: transaction + order
MCP-->>Agent: CheckoutSessionWithOrder {status: completed, order}
Tools
tools/list is generated from the official OpenRPC file. Each tool’s inputSchema holds meta, id and payload as the OpenRPC params define them, with every referenced ACP schema bundled into the tool’s own $defs (the binding requires $ref targets to be resolved), and its outputSchema is the method’s result schema.
| Tool | Arguments | Result |
|---|---|---|
create_checkout_session | meta, payload (CheckoutSessionCreateRequest: currency, line_items[] of { id }, capabilities) | CheckoutSession |
get_checkout_session | meta, id | CheckoutSession |
update_checkout_session | meta, id, payload (CheckoutSessionUpdateRequest; line_items[] replaces the session’s items) | CheckoutSession |
complete_checkout_session | meta, id, payload (CheckoutSessionCompleteRequest: payment_data.handler_id, payment_data.instrument.credential.token, optional buyer) | CheckoutSessionWithOrder (status: completed, order { id, checkout_session_id, permalink_url }) |
cancel_checkout_session | meta, id, optional payload (CancelSessionRequest) | CheckoutSession with status: canceled |
ACP’s delegate payment API is out of scope for the binding (the ACP spec leaves it to a later proposal); it stays on REST at /api/v1/acp/delegate_payment.
meta. meta.api_version (the API-Version header) is required and must be 2026-04-17. meta.idempotency_key keys complete_checkout_session. Other meta fields are accepted and ignored, except merchant_id, below.
Merchant. ACP payloads name no merchant, so a session belongs to meta.merchant_id when sent, else to UCP_DEFAULT_MERCHANT_ID. With neither, the call fails with merchant_required.
Items. An ACP Item carries no quantity: each line_items[] entry is one unit, so [{ "id": "sku-1" }, { "id": "sku-1" }] is a line with quantity 2. Fields of the payload the orchestrator has no backend for (fulfillment_details, selected_fulfillment_options, discounts, intent_trace, …) are validated and then ignored. Purchase-order payments (payment_data.purchase_order_number) are refused with unsupported_payment_method.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "create_checkout_session",
"arguments": {
"meta": { "api_version": "2026-04-17", "idempotency_key": "idem_1" },
"payload": { "currency": "usd", "line_items": [{ "id": "demo-tee" }], "capabilities": {} }
}
}
}
Results
ACP returns the CheckoutSession itself as the JSON-RPC result. MCP clients read tool output from structuredContent and content[], so the result carries both views as well:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"id": "cs_...", "protocol": { "version": "2026-04-17" }, "status": "ready_for_payment",
"currency": "usd", "line_items": [...], "totals": [...], "capabilities": {},
"fulfillment_options": [], "messages": [], "links": [],
"structuredContent": { "id": "cs_...", ... },
"content": [{ "type": "text", "text": "{\"id\":\"cs_...\",...}" }]
}
}
Without the two MCP members the result validates against ACP’s CheckoutSession / CheckoutSessionWithOrder schema, and structuredContent always does. A session with items is ready_for_payment (complete starts checkout itself), one without is not_ready_for_payment.
Idempotency
complete_checkout_sessionreplays its first outcome for the samemeta.idempotency_key; the payment is not taken twice.- Without a key the session itself is the key (a session can be paid for once), so a retried complete still replays.
- A key already spent on another session is
invalid_request/idempotency_conflict. - Cancelling a canceled session is
invalid_request/session_not_cancelable(REST answers405).
Errors
| Situation | Response |
|---|---|
| Unknown or malformed session id | -32000, data.type: invalid_request, data.code: session_not_found, data.param: $.id |
| Payload that breaks the ACP schema | -32000, invalid_request, invalid_payload, data.param a JSONPath into $.payload |
Missing or unsupported meta.api_version | -32000, invalid_request, missing_api_version / unsupported_api_version with data.supported_versions |
| No merchant | -32000, invalid_request, merchant_required |
| Another tenant’s session | -32000, invalid_request, forbidden |
| Session already canceled | -32000, invalid_request, session_not_cancelable |
| Idempotency key spent on another session | -32000, invalid_request, idempotency_conflict |
| Declined payment | -32000, processing_error, payment_declined |
| Provider unavailable / server fault | -32000, service_unavailable / processing_error |
Missing meta, id or payload argument, unknown tool | -32602 |
| No or invalid bearer token | HTTP 401 from the MCP server, outside the ACP error model |
data is always a valid ACP Error (type, code, message, optional param), and the JSON-RPC message repeats data.message.
Metrics
Each tool call records orchestrator_operation_calls_total and orchestrator_operation_latency_seconds with operation="acp_mcp_<tool>" and status set to success or the ACP error code (session_not_found, invalid_payload, forbidden, idempotency_conflict, …; invalid_params for malformed calls). Counters acp_mcp_tools_list_total, acp_mcp_initialize_total and acp_mcp_parse_error_total cover the rest, and tool calls increment the same acp_checkout_session_*_total counters as the REST binding.
See also
- Consumption guide — REST shapes, config, message signing
- Consumer integration — auth and client setup
- Conformance matrix — protocol coverage and gaps
Plug Your APIs and Deploy
This guide walks from zero to a running Commerce Orchestrator calling your six downstream APIs, with local smoke tests and deployment validation.
Prerequisites
- Rust toolchain (for local run and tests).
- Docker (for container build).
- Kubernetes cluster or Docker Compose for deployment (or run the server locally and point it at stub/mock URLs for development).
- An operating-system CA trust store on the host or image. Outbound HTTPS (providers, OAuth token endpoints, Web Bot Auth key directories) is verified against the platform’s trust store, not a bundled root list. The provided image installs
ca-certificates. If you build a custom image, install it too, or add your private CA there.
1. Downstream API Contracts
The orchestrator calls your services over HTTP. Each base URL must not have a trailing slash. Implement the following endpoints so the integration adapters can call them.
The machine-readable version of this section is the OpenAPI 3.1 spec providers/openapi.yaml. Generate server stubs from it, or load it into your API tooling. A test in the integration-adapters crate checks it against the adapters on every CI run, so it does not drift from what the orchestrator actually sends.
Catalog
| Method | Path | Request | Response (200) |
|---|---|---|---|
GET | {base}/items/{item_id} | — | { "id": "<string>", "title": "<string>", "price_minor": <integer> } |
POST | {base}/catalog/lookup | { "ids": ["<string>"] } | { "products": [ { "id", "title", "price_minor" } ] } |
POST | {base}/catalog/search | { "query": "<string>"? } | { "products": [ { "id", "title", "price_minor" } ] } |
- 404 or non-2xx: item not found or error.
Pricing
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/prices/resolve | Cart projection (see adapter) | { "prices": [ { "line_id": "<string>", "unit_price_minor": <int>, "total_minor": <int> } ] } |
POST | {base}/discounts/resolve | { "cart": <cart projection>, "codes": ["<string>"] } | { "discounts": [ { "code": "<string>", "description": "<string>"?, "amount_minor": <int>, "line_id": "<string>"? } ] } |
- Request body is the orchestrator’s cart projection; your service returns one price entry per line.
discounts/resolveprices the buyer’s adjustment codes. Return only the codes you grant; a non-2xx rejects the codes (use it for expired or ineligible campaigns), andamount_minoris positive and is clamped to the amount owed. It is only called when the cart carries at least one code.
Tax
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/tax/resolve | Cart projection | { "total_tax_minor": <integer> } |
Geo
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/geo/check | { "cart": <CartProjection>, "request": <CheckoutRequest> } | { "allowed": <boolean> } |
- Return
allowed: trueif the cart/request is allowed in the given geography; otherwisefalse.
Payment
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/authorize | Checkout request | { "authorized": <boolean>, "reference": "<string>" } |
POST | {base}/capture | Payment lifecycle request | { "success": <boolean>, "reference": "<string>" } |
POST | {base}/void | Payment lifecycle request | { "success": <boolean>, "reference": "<string>" } |
POST | {base}/refund | Payment lifecycle request | { "success": <boolean>, "reference": "<string>" } |
GET | {base}/state/{transaction_id} | — | Optional: `{ “state”: “<authorized |
- For reconciliation, implement
GET .../state/{transaction_id}; if you don’t, the orchestrator treats provider state as unknown.
3DS2 step-up (optional). Set PAYMENT_AUTHENTICATION_ENABLED=true only if your payment service implements these:
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/authorize | Checkout request | Add "authentication_required": { "authentication_id", "device_data_collection_url"?, "challenge_url"?, "acquirer_details"?, "directory_server"? } with "authorized": false when the issuer wants 3DS2 first |
GET | {base}/authentication/{authentication_id} | — | { "status": "pending" } or { "status": "completed", "result": { "outcome", "electronic_commerce_indicator"?, "three_ds_cryptogram"?, "transaction_id"?, "version"? } } |
POST | {base}/authentication/{authentication_id}/authorize | { "checkout": <CheckoutRequest>, "result": <AuthenticationResult> }, Idempotency-Key: <checkout key>:authenticated | { "authorized": <boolean>, "reference": "<string>" } |
- The URLs are pages you host that run the 3DS Method and the challenge in the buyer’s browser; EMV 3DS messages never pass through the orchestrator.
acquirer_details(acquirer_bin,acquirer_country,acquirer_merchant_id,merchant_name) anddirectory_server(visa,mastercard,american_express) are what ACP agents need for delegate authentication; without both, ACP sessions show noauthentication_metadata.outcomeuses ACP’s values (authenticated,attempt_acknowledged,denied,rejected,abandoned, …). The orchestrator only calls/authorizeon the authentication forauthenticatedandattempt_acknowledged.- Without the flag, an
authentication_requiredanswer is treated as a decline and 3DS2 is not advertised.
Receipt
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/receipts/generate | { "cart": <CartProjection>, "result": <TransactionResult> } | { "content": "<string>" } |
contentis the receipt text or payload your system returns (e.g. PDF URL or plain text).
Fulfillment (optional)
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/fulfillment/quote | { "cart": <CartProjection>, "method_type": "shipping"|"pickup", "destination": <destination>, "line_item_ids": ["<string>"] } | { "options": [ { "id", "title", "description"?, "carrier"?, "earliest_fulfillment_time"?, "latest_fulfillment_time"?, "amount_minor" } ] } |
- Without
FULFILLMENT_BASE_URL, the orchestrator quotes its built-in standard, express and pickup options.
Payment delegation (optional)
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/delegate_payment | { "tenant_id": "<string>", "token": "<caller token>", "method_type": "<string>?", "max_amount_minor": <int>?, "metadata": { } } | { "id": "<string>", "token": "<delegated token>", "status": "delegated", "expires_at": "<rfc3339>?" } |
- The returned
tokenmust be a new, scoped credential — returning the caller’s own token grants nothing and is not delegation. - The orchestrator forwards
Idempotency-Keyso a retry cannot mint two tokens. - Without
PAYMENT_DELEGATION_BASE_URL,POST /api/v1/acp/delegate_paymentreturns501 NOT_CONFIGUREDand the ACP discovery document omits thedelegate_paymentservice.
Identity linking (optional)
| Method | Path | Request (JSON body) | Response (200) |
|---|---|---|---|
POST | {base}/identity/link | { "tenant_id": "<string>", "merchant_id": "<string>", "agent_id": "<string>", "link_token": "<string>" } | { "link_id": "<string>", "status": "linked", "expires_at": "<rfc3339>?" } |
- Without
IDENTITY_LINK_BASE_URL,POST /api/v1/a2a/identity/linkreturns501 NOT_CONFIGUREDanddev.ucp.common.identity_linkingis absent from discovery. - Without
EMBEDDED_CHECKOUT_URL(or without signing keys),POST /api/v1/ucp/checkout/:id/embedded-linkreturns501 NOT_CONFIGUREDand theembeddedtransport is absent from discovery.
For exact request shapes, see the integration adapter types in the repo (integration-adapters crate) and the wiremock tests under crates/integration-adapters/tests/ (e.g. catalog_http_test.rs, adapters_http_test.rs).
2. Environment Variables
Configure the server with these (see also Consumption guide – Config reference and deploy/README.md).
| Variable | Required (production) | Description | Example |
|---|---|---|---|
ENV | Yes | production enables auth and real adapters. | production |
PUBLIC_BASE_URL | Yes | Public base URL advertised in /.well-known/ucp; required in production to avoid localhost discovery output. | https://orchestrator.example.com |
DATABASE_URL | Yes | PostgreSQL connection string for durable runtime state. | postgres://orchestrator:secret@postgres:5432/orchestrator |
AUTH_MODE | Yes | static or jwt. | static |
AUTH_BEARER_TOKEN | Yes (when AUTH_MODE=static) | Secret token; clients send Authorization: Bearer <token>. | (secret) |
AUTH_JWT_HS256_SECRET | Yes (when AUTH_MODE=jwt) | HS256 secret used to verify JWT tokens. | (secret) |
CATALOG_BASE_URL | Yes | Catalog service base URL, no trailing slash. | http://catalog-service:8080 |
PRICING_BASE_URL | Yes | Pricing service base URL. | http://pricing-service:8080 |
TAX_BASE_URL | Yes | Tax service base URL. | http://tax-service:8080 |
GEO_BASE_URL | Yes | Geo service base URL. | http://geo-service:8080 |
PAYMENT_BASE_URL | Yes | Payment service base URL. | http://payment-service:8080 |
RECEIPT_BASE_URL | Yes | Receipt service base URL. | http://receipt-service:8080 |
UCP_SIGNING_KEY_ID | Yes | Key id advertised in discovery and sent as keyid in Signature-Input. | orch-2026-a |
UCP_SIGNING_KEY | Yes | Base64 32 bytes for the active signing key: an Ed25519 seed, or a P-256 private scalar with UCP_SIGNING_KEY_ALG=ES256. Production refuses to start without it. | (secret) |
UCP_SIGNING_KEY_ALG | No | EdDSA (default) or ES256. ES256 is the algorithm every UCP verifier must support. | ES256 |
UCP_SIGNING_PREVIOUS_KEYS | No | Retired keys still published for verification during rotation, kid:seed or kid:ES256:secret, comma-separated. | orch-2025-b:<seed> |
UCP_AGENT_JWKS | No | Agent public keys as a JWK Set JSON ({"keys":[...]}, Ed25519 or P-256), as agents publish them in their UCP profile. Setting this or UCP_AGENT_KEYS makes inbound RFC 9421 signatures mandatory on /api/v1. | {"keys":[{"kid":"agent-1","kty":"EC",...}]} |
UCP_AGENT_KEYS | No | Ed25519 agent public keys, kid:base64-public-key comma-separated. | agent-1:<public key> |
PAYMENT_DELEGATION_BASE_URL | No | PSP delegation service. Without it POST /api/v1/acp/delegate_payment returns 501 and the ACP delegate_payment service is not advertised. | http://psp-delegation:8080 |
PAYMENT_AUTHENTICATION_ENABLED | No | true when the payment service implements 3DS2 step-up (authentication_required and the /authentication endpoints). Off by default: UCP dev.ucp.common.payment.authentication and the ACP 3ds intervention are not advertised, and a step-up answer is a decline. | true |
IDENTITY_LINK_BASE_URL | No | Identity system for agent identity linking. Without it identity linking returns 501 and dev.ucp.common.identity_linking is not advertised. | http://identity:8080 |
EMBEDDED_CHECKOUT_URL | No | Your hosted embedded checkout page. Handoff links point here with session, expires, kid and token query parameters; verify token as an Ed25519 signature over ucp-embedded-checkout:{session}:{expires} using the JWK named by kid in /.well-known/ucp. Requires signing keys. | https://shop.example.com/checkout/embedded |
MPP_CHALLENGE_SECRET | No | HMAC key that binds MPP Payment challenges. Set, MPP checkouts must answer a 402 challenge and get a Payment-Receipt. Unset, they are not challenged. Keep it in the Secret, and use the same value on every replica. | 32+ random bytes |
MPP_REALM | No | Realm named in MPP challenges. Defaults to the host of PUBLIC_BASE_URL; startup fails if neither is set while MPP_CHALLENGE_SECRET is. | shop.example.com |
MPP_CHALLENGE_TTL_SECS | No | How long an MPP challenge stays answerable, 1–3600. Default 300. | 300 |
UCP_PAYMENT_HANDLERS | No | Your payment providers’ UCP handlers, published as ucp.payment_handlers: JSON object keyed by reverse-DNS handler name, each an array of entries with id and a YYYY-MM-DD version (plus spec, schema, available_instruments, config as the handler defines). Validated at startup; unset publishes {}. | {"com.example.tokenizer":[{"id":"tok","version":"2026-08-25",...}]} |
UCP_DEFAULT_MERCHANT_ID | No | The default merchant for every protocol whose payloads carry none: UCP carts and checkouts without a merchant_id, and ACP checkout sessions and carts (REST and MCP; over MCP meta.merchant_id wins). A request value wins. Unset, such requests get MERCHANT_REQUIRED. | shop-main |
UCP_CATALOG_CURRENCY | No | ISO 4217 currency for UCP catalog prices on the MCP binding when the request has no context.currency (which wins), and for ACP carts (ACP lets the seller pick it). Validated at startup. Unset, such requests get a currency_required error. | USD |
UCP_PROFILE_NEGOTIATION | No | UCP platform profile negotiation on /api/v1/ucp/* and /api/v1/ucp/mcp: off (default, nothing fetched), lenient (fetch and negotiate, never refuse) or strict (refuse as UCP requires: invalid_profile_url, profile_unreachable, profile_malformed, version_unsupported, capabilities_incompatible). Needs egress on 443 to platforms’ profile hosts. See negotiation. | lenient |
MCP_ALLOWED_ORIGINS | No | Browser origins allowed to call the MCP endpoints (scheme://host[:port], comma-separated), or *. Validated at startup. Unset, a request carrying an Origin header is refused with 403 (DNS-rebinding protection); agents calling from servers send no Origin and are unaffected. | http://localhost:6274 |
FULFILLMENT_BASE_URL | No | Shipping rate service. Without it the built-in static rate table is used. | http://fulfillment:8080 |
MIGRATE_ONLY | No | true applies pending migrations and exits, same as passing --migrate. Used by the migration Job. | true |
BIND_ADDR | No | Listen address. | 0.0.0.0:8080 |
RUST_LOG | No | Log level. | info |
OUTBOX_INTERVAL_MS | No | Outbox processor poll interval. | 1000 |
OUTBOX_BATCH_SIZE | No | Messages dequeued per poll. | 50 |
OUTBOX_MAX_ATTEMPTS | No | Attempts before a message is dead-lettered. | 8 |
OUTBOX_DRAIN_TIMEOUT_SECS | No | Shutdown drain budget; keep below the pod’s termination grace period. | 30 |
OUTBOX_RETRY_BACKOFF_MS | No | Pause after a failed delivery, doubled per attempt. | 500 |
OUTBOX_MAX_RETRY_BACKOFF_SECS | No | Ceiling for that pause. | 30 |
PROVIDER_CIRCUIT_PROBE_TIMEOUT_SECS | No | How long a half-open probe may stay in flight before another is admitted. | 60 |
AUTH_TENANT_ID | No | Default tenant for auth context. | prod |
AUTH_CALLER_ID | No | Default caller id. | prod |
AP2_TRUSTED_ISSUERS | No | Comma-separated allowlist for strict AP2 issuer checks. | issuer.example |
Example .env for local runs (replace with your stub or real URLs):
ENV=production
PUBLIC_BASE_URL=https://orchestrator.example.com
DATABASE_URL=postgres://orchestrator:secret@localhost:5432/orchestrator
AUTH_MODE=static
AUTH_BEARER_TOKEN=dev-token-change-in-prod
CATALOG_BASE_URL=http://localhost:9001
PRICING_BASE_URL=http://localhost:9002
TAX_BASE_URL=http://localhost:9003
GEO_BASE_URL=http://localhost:9004
PAYMENT_BASE_URL=http://localhost:9005
RECEIPT_BASE_URL=http://localhost:9006
UCP_SIGNING_KEY_ID=orch-2026-a
UCP_SIGNING_KEY=$(openssl rand -base64 32)
3. Local Smoke Test (no deployment)
Without ENV=production the orchestrator runs in development mode: it uses built-in mock providers with a demo catalog (demo-tee, demo-mug, demo-cap), accepts unauthenticated calls as tenant dev, and ignores the *_BASE_URL settings. That is enough to try the API (see the README quick start). To smoke-test against your providers, run with ENV=production and the full production configuration from step 2.
- Start your six downstream services (or stubs) so they listen on the URLs you set in step 2.
- Start local Postgres (or point to an existing instance):
docker compose up -d postgres - Start the orchestrator:
cargo run -p orchestrator-http --bin orchestrator-server - Health:
curl -s http://localhost:8080/health/live curl -s http://localhost:8080/health/ready - Create cart and run checkout (use your tenant/merchant IDs and payment token as needed):
See Consumption guide for full request/response shapes.# Create cart curl -s -X POST http://localhost:8080/api/v1/cart/commands \ -H "Content-Type: application/json" \ -H "Authorization: Bearer dev-token-change-in-prod" \ -d '{"command":{"kind":"create_cart","merchant_id":"m1","currency":"USD"},"cart_id":null}' # Add item (use cart_id and line IDs from create_cart response) # Then start_checkout, then POST /api/v1/checkout/execute with cart_id, cart_version, payment_intent, idempotency_key, etc. - Payment lifecycle (after a successful checkout):
curl -s -X POST http://localhost:8080/api/v1/payments/capture \ -H "Content-Type: application/json" \ -H "Authorization: Bearer dev-token-change-in-prod" \ -d '{"tenant_id":"t1","merchant_id":"m1","transaction_id":"<tx_id>","amount_minor":1000,"idempotency_key":"cap-1"}' - Ops: Hit
POST /api/v1/ops/outbox/process,GET /api/v1/ops/dead-letter,POST /api/v1/ops/reconciliationas needed (see runbooks).
4. Staging Deployment (Kubernetes)
- Get the image. Each release tag publishes a multi-arch (
linux/amd64,linux/arm64) image to GitHub Container Registry, with an SBOM and build provenance attached. The manifests already reference it:
To run your own build instead, build from the repo root, push it to your registry, and override the image in step 5:docker pull ghcr.io/ancientice/commerce-orchestrator-api:0.13.0
With Helm, install the chart indocker build -t <your-registry>/commerce-orchestrator-api:<tag> . docker push <your-registry>/commerce-orchestrator-api:<tag>deploy/helm/commerce-orchestratorinstead of steps 2 to 5; see deployment. - Edit manifests under
deploy/kubernetes/:configmap.yaml: Set all six*_BASE_URLto your staging service URLs, plus any optional providers you run (FULFILLMENT_BASE_URL,PAYMENT_DELEGATION_BASE_URL,IDENTITY_LINK_BASE_URL).secret.yamlor create the secret manually: SetDATABASE_URL, auth variables based onAUTH_MODE(AUTH_BEARER_TOKENorAUTH_JWT_HS256_SECRET), the signing key pair (UCP_SIGNING_KEY_ID,UCP_SIGNING_KEY), and optionalAUTH_TENANT_ID,AUTH_CALLER_ID.
- Migrate before the new image serves traffic:
The Job runs the server image withkubectl apply -f deploy/kubernetes/job-migrate.yaml kubectl wait --for=condition=complete job/orchestrator-api-migrate --timeout=5m--migrate, which applies pending migrations and exits. Replicas also migrate on startup under a PostgreSQL advisory lock, so a missed Job is recoverable — but a broken migration then fails once here instead of crash-looping every pod. - Apply (ensure namespace exists):
kubectl apply -f deploy/kubernetes/ - Override image to pin a different tag or run your own build:
kubectl set image deployment/orchestrator-api orchestrator-server=ghcr.io/ancientice/commerce-orchestrator-api:0.13.0 - Ensure database reachability from the orchestrator pod (network policy, DNS, credentials, and TLS as required by your platform). The shipped NetworkPolicy allows egress to TCP 5432.
- Scale safely: the manifests ship two replicas. All durable state is in PostgreSQL, outbox dequeue uses
FOR UPDATE SKIP LOCKED, and idempotency keys are stored centrally, so replicas neither double-deliver nor double-charge. Tune the connection pool and database capacity as you scale. - Wire up monitoring: apply
servicemonitor.yaml(Prometheus Operator) and importdeploy/grafana/orchestrator-dashboard.json. See deployment.
5. Post-Deploy Validation Checklist
Run these after deployment to confirm the system is ready for traffic:
- Liveness:
GET /health/livereturns 200. - Readiness:
GET /health/readyreturns 200. - Auth: Request without
Authorization: Bearer <token>to a protected endpoint returns 401. - Cart: Create cart, add item, get cart; responses successful and cart projection looks correct.
- Checkout: Execute checkout with valid cart and payment intent; response includes
transaction_idand success status. - Payment lifecycle: Capture (and optionally void/refund) using
transaction_idfrom checkout; responses indicate success. - Events:
POST /api/v1/events/incomingwith amessage_idreturns 200 (idempotent). - Outbox:
POST /api/v1/ops/outbox/processwith body e.g.{"max_attempts":3}returns 200. - Dead-letter:
GET /api/v1/ops/dead-letterreturns 200 (list may be empty). - Reconciliation:
POST /api/v1/ops/reconciliationwith body{"transaction_ids":["<tx_id>"]}returns 200; check response for mismatches if your payment provider supports state. - Metrics:
GET /metricsreturns Prometheus text and the Grafana dashboard populates. - Discovery honesty:
GET /.well-known/ucpadvertises a signing key you control, and listsdev.ucp.common.identity_linkingonly if you configuredIDENTITY_LINK_BASE_URL.
If any step fails, check server logs, downstream connectivity, and runbooks (e.g. dead-letter handling, reconciliation).
Next Steps
- Consumer integration — REST API usage and auth.
- Consumption guide — Full request/response shapes and config.
- Provider OpenAPI spec — The downstream APIs above, as OpenAPI 3.1.
- Deployment — Kubernetes details, secrets, HPA, rollback.
- Runbooks — Outbox, dead-letter, reconciliation.
Provider API (OpenAPI)
The orchestrator does not hold your catalog, prices, tax rules or payments. It calls your services for them. This page describes the HTTP API those services expose to the orchestrator.
Spec: openapi.yaml (OpenAPI 3.1). Load it into your API tooling, generate server stubs from it, or validate your service’s responses against it.
Services
Each service has its own base URL, set in the orchestrator’s configuration. The paths in the spec are appended to that base URL.
| Service | Base URL setting | Endpoints | Required |
|---|---|---|---|
| Catalog | CATALOG_BASE_URL | GET /items/{item_id}, POST /catalog/lookup, POST /catalog/search | Yes |
| Pricing | PRICING_BASE_URL | POST /prices/resolve, POST /discounts/resolve | Yes |
| Tax | TAX_BASE_URL | POST /tax/resolve | Yes |
| Geo | GEO_BASE_URL | POST /geo/check | Yes |
| Payment | PAYMENT_BASE_URL | POST /authorize, /capture, /void, /refund, GET /state/{transaction_id} | Yes |
| Receipt | RECEIPT_BASE_URL | POST /receipts/generate | Yes |
| Fulfillment | FULFILLMENT_BASE_URL | POST /fulfillment/quote | No: built-in rates are used without it |
| Payment delegation | PAYMENT_DELEGATION_BASE_URL | POST /delegate_payment | No: ACP delegated payment returns 501 without it |
| Identity linking | IDENTITY_LINK_BASE_URL | POST /identity/link | No: UCP identity linking is not advertised without it |
| 3DS2 step-up (payment) | PAYMENT_BASE_URL + PAYMENT_AUTHENTICATION_ENABLED=true | authentication_required on POST /authorize, GET /authentication/{id}, POST /authentication/{id}/authorize | No: without it 3DS2 is not advertised and a step-up answer is a decline |
sequenceDiagram
participant O as Orchestrator
participant C as Catalog
participant Pr as Pricing
participant T as Tax
participant G as Geo
participant Pa as Payment
participant R as Receipt
Note over O: Agent adds an item
O->>C: GET /items/{item_id}
O->>Pr: POST /prices/resolve
O->>T: POST /tax/resolve
O->>Pr: POST /discounts/resolve (only with codes)
O->>G: POST /geo/check
Note over O: Agent checks out
O->>Pr: POST /prices/resolve
O->>T: POST /tax/resolve
O->>Pr: POST /discounts/resolve (only with codes)
O->>G: POST /geo/check
O->>Pa: POST /authorize (Idempotency-Key)
O->>Pa: POST /capture (Idempotency-Key)
O->>R: POST /receipts/generate
Rules every provider should follow
- Money is an integer in minor units (cents for USD), never a float.
- Honour
Idempotency-Keyon authorize, capture, void, refund and delegate payment. A repeat with the same key must return the first outcome without moving money again. The orchestrator relies on this to retry safely. - Answer non-2xx for failures. Any non-2xx response fails that step. Transient statuses (408, 425, 429, 500, 502, 503, 504) are retried for GETs and idempotency-keyed requests, honouring
Retry-Afterup to 30 seconds. - Ignore fields you do not need. The orchestrator sends its full cart projection; new optional fields can appear in later versions.
How the spec stays accurate
crates/integration-adapters/tests/openapi_spec_test.rs runs in CI. It answers the real adapters with the spec’s own response examples, then checks that every request they sent goes to a documented path, carries the headers the spec requires, and validates against the documented request schema. Request schemas reject unknown fields, so a field added to the wire without updating the spec fails the build.
For the same contracts as tables, with notes on each endpoint’s behaviour, see plug and deploy.
Agentic Commerce Standards Conformance Matrix
This document records target protocol versions and the Commerce Orchestrator’s conformance status. Conformance is verified by tests referenced in the Evidence column.
Target Protocol Versions
| Protocol | Target Version | Spec / Reference |
|---|---|---|
| UCP business profile | 2026-08-25 (with 2026-04-08, 2026-01-23 and 2026-01-11 profiles linked from supported_versions) | UCP spec; profile validated against the official profile.json#/$defs/business_schema; UCP REST binding; RFC 9421 signatures |
| A2A (Agent-to-Agent) | 1.0 (patch 1.0.1; 0.3 envelopes and JSON-RPC message/send retained) | A2A spec; Agent Card, HTTP+JSON and JSON-RPC SendMessage / SendStreamingMessage (SSE); A2A-Version negotiation on the envelope routes |
| MCP (Model Context Protocol) | Dual-era: 2026-07-28 modern + 2025-11-25 / 2024-11-05 legacy | server/discover + per-request version meta; legacy initialize retained |
| AP2 (Agent Payments Protocol) | 0.2 | AP2 spec; closed + open (HNP) mandates, VDCs |
| ACP (Agentic Commerce Protocol) | 2026-04-17 | ACP OpenAPI; merchant-hosted checkout sessions, Cart capability, delegate payment, mandatory Idempotency-Key, and /.well-known/acp.json discovery |
| MPP (Machine Payments Protocol) | draft-httpauth-payment-01 (charge intent: draft-payment-intent-charge-00) | MPP protocol, Payment auth drafts; HTTP 402 challenge/credential/receipt on REST checkout, the MCP transport (-32042, _meta credential/receipt) on the native MCP execute_checkout tool, and method/intent metadata |
Conformance Matrix
Status values: required (must pass for claimed alignment), optional (supported when implemented), not_supported_yet (planned or out of scope).
Discovery (UCP)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Well-known discovery endpoint | required | Default GET /.well-known/ucp returns a 2026-08-25 business profile that validates against the official UCP JSON Schema (vendored in crates/orchestrator-http/tests/fixtures/ucp/2026-08-25), configured or not; it is served with Cache-Control: public, max-age=300 | ucp_profile_schema_test::an_unconfigured_deployment_publishes_a_valid_profile, ucp_profile_schema_test::a_fully_configured_deployment_publishes_a_valid_profile, ucp_profile_schema_test::the_profile_is_publicly_cacheable_for_at_least_a_minute |
| Older protocol versions | required | supported_versions maps 2026-04-08, 2026-01-23 and 2026-01-11 to ?ucp_version= profile URIs; each linked profile declares that version and carries no supported_versions of its own. The 2026-04-08 profile keeps its previous shape (in-ucp signing_keys, handler list, acp/mcp transports) for platforms still on it | ucp_profile_schema_test::older_versions_link_to_self_contained_profiles, authz_and_adapters::the_2026_04_08_profile_keeps_its_shape_for_platforms_still_on_it |
| Version-match rule | required | Every dev.ucp.* service and capability entry declares the profile’s own version | ucp_profile_schema_test::every_ucp_entry_declares_the_profile_version |
| Only implemented bindings listed | required | dev.ucp.shopping lists rest, mcp (UCP’s MCP binding at /api/v1/ucp/mcp), a2a (UCP’s A2A binding, endpoint = the Agent Card) and embedded (when configured) only. The orchestrator’s native MCP server is not UCP’s MCP binding and ACP is its own protocol, so their endpoints move to the top-level orchestrator member (mcp_endpoint, mcp_supported_versions, acp_discovery, acp_api_version, a2a_profile_version, ap2_protocol_version, capability_flags) — only UCP core may define members inside ucp | ucp_profile_schema_test::only_bindings_we_implement_are_listed_as_ucp_transports |
| Payment handler registry | required | ucp.payment_handlers is always present, as a reverse-DNS keyed registry; it is {} unless the operator publishes their providers’ handlers via UCP_PAYMENT_HANDLERS (validated at startup). Payment handlers are not a capability | ucp_profile_schema_test::payment_handlers_are_always_present_and_published_as_configured, ucp_profile_schema_test::payment_handlers_are_not_a_capability, config tests |
| Capability IDs | required | Latest profile advertises checkout, cart, catalog.lookup/search, order, discount, and fulfillment, with 2026-08-25 spec URLs; identity_linking appears only when an identity provider is configured | Same; honest_discovery_test::discovery_hides_identity_linking_until_a_provider_is_configured |
| Multi-parent extensions | required | dev.ucp.shopping.discount extends both checkout and cart in the latest profile | discovery tests |
| Advertised capabilities map to implemented routes | required | Every latest advertised capability has a corresponding executable REST, A2A, or MCP operation | Conformance test: capability_route_parity |
| Signing keys advertisement | required | Discovery publishes the operator’s real public JWKs (Ed25519 and/or P-256) as the top-level keys[] JWK Set beside ucp (signing_keys was removed in 2026-08-25) and sets dev.ucp.security.signatures only when signing material is configured; an unsigned deployment advertises neither. Agent JWK Sets tolerate unknown key types | ucp_profile_schema_test::signing_keys_are_a_top_level_jwk_set, ucp_signing::a_jwks_key_of_an_unknown_type_is_skipped_not_fatal, discovery_test::discovery_advertises_acp_signing_and_payment_handlers, discovery_test::discovery_omits_signing_keys_when_no_keyring_is_configured; orchestrator_api::SigningKeyring |
| Response signing | required | Every response carries RFC 9530 Content-Digest and RFC 9421 Signature-Input/Signature (label sig1) covering @status, content-digest, and content-type, verifiable with the advertised JWK | ucp_signature_test::responses_are_signed_with_the_active_key, ucp_signature_test::rejections_are_signed_too_so_clients_can_trust_them |
| Request signature verification | required | With agent keys configured (UCP_AGENT_JWKS / UCP_AGENT_KEYS), /api/v1 requests must carry an RFC 9421 signature covering @method, @authority, @path, @query (when present), content-digest + content-type (with a body), and idempotency-key/ucp-agent/signature-agent (when present); the body must match Content-Digest; created within 300s and expires honoured; any one valid signature authenticates. Failures return UCP codes signature_missing/signature_invalid/key_not_found (401) or digest_mismatch/algorithm_unsupported (400) | ucp_signature_test suite; ucp_signing suite incl. rfc_9421_ed25519_test_vector_signature_base_and_value |
| Signature algorithms | required | ES256 (mandatory-to-verify baseline) and Ed25519 accepted for verification and usable for signing (UCP_SIGNING_KEY_ALG); algorithm derived from the key, alg parameter cross-checked | ucp_signing::es256_signed_request_verifies, ucp_signature_test::an_es256_signed_request_is_accepted |
Key rotation by kid | required | Both signing and verification accept a retired and a current kid simultaneously (UCP_SIGNING_PREVIOUS_KEYS, multiple agent keys) so counterparties can switch without downtime | ucp_signing::both_kids_verify_during_a_rotation, ucp_signature_test::both_kids_are_accepted_during_rotation |
| Web Bot Auth signatures | optional | Opt-in draft-ietf-webbotauth-httpsig-protocol-01: HTTPS directory resolution, URL-bound caches, thumbprint key selection, required tag/timestamps, key validity and Ed25519/P-256 verification. Configure WEB_BOT_AUTH_DIRECTORY_URLS or server.web_bot_auth_directory_urls. This establishes operator identity, independent of account authorization. RSA, legacy bare-string headers, directory redistribution and Signed-Agent-Metadata policy are outside this profile | webbot_components, webbot_identity, webbot_http |
Platform profile negotiation (UCP-Agent) | required (opt-in: UCP_PROFILE_NEGOTIATION) | With lenient or strict, the profile named by the UCP-Agent header (RFC 8941 dictionary, profile="https://...") on /api/v1/ucp/* or by meta["ucp-agent"].profile on /api/v1/ucp/mcp is fetched (HTTPS only, no redirects, special-use addresses refused and the connection pinned to the checked address, 3 s connect / 5 s total, 256 KiB cap) and cached per URL for its max-age clamped to 60 s–1 h (failures 15 s, 256 URLs). The platform’s ucp.version must be 2026-08-25 or a supported_versions key; capabilities are intersected (shared names, highest mutual version, orphaned extensions pruned until stable) and each response’s ucp.capabilities lists only negotiated ones. strict refuses with invalid_profile_url (400), profile_unreachable (424), profile_malformed (422), version_unsupported (422) as {code, content} on REST and -32001 on MCP, and an operation outside the intersection with a 200 capabilities_incompatible UCP error response; lenient counts the failure and proceeds unnegotiated; off (default) fetches nothing. Unauthenticated requests never trigger a fetch | ``ucp_negotiation_test::rest_responses_list_only_negotiated_capabilities, ucp_negotiation_test::strict_rest_refuses_each_negotiation_failure_with_the_specified_status, ucp_negotiation_test::a_malformed_ucp_agent_header_is_an_invalid_profile_url, ucp_negotiation_test::an_operation_outside_the_intersection_is_capabilities_incompatible, ucp_negotiation_test::lenient_rest_proceeds_without_negotiation_when_it_fails, ucp_negotiation_test::an_unnegotiated_deployment_lists_every_capability, ucp_negotiation_test::profiles_are_fetched_once_and_then_served_from_the_cache, ucp_negotiation_test::mcp_reports_negotiation_failures_as_discovery_errors, ucp_negotiation_test::mcp_reports_capabilities_incompatible_as_a_result, ucp_negotiation_test::rest_and_mcp_negotiate_the_same_capabilities, ucp_negotiation_test::negotiation_is_counted_timed_and_labelled_by_outcome, ucp_negotiation_test::unauthenticated_requests_never_trigger_a_profile_fetch, ucp_negotiation::tests::the_profile_member_is_read_from_an_rfc_8941_dictionary, ucp_negotiation::tests::intersection_keeps_shared_capabilities_at_the_highest_mutual_version, ucp_negotiation::tests::orphaned_extensions_are_pruned_transitively, ucp_negotiation::tests::platform_profiles_must_have_the_required_registries, ucp_negotiation::tests::strict_negotiation_reports_each_failure_with_its_code, ucp_negotiation::tests::profiles_and_failures_are_cached_per_url, ucp_negotiation::tests::the_cache_is_bounded, outbound::tests::private_and_special_addresses_are_not_public, outbound::tests::loopback_and_private_hosts_are_refused_before_connecting, outbound::tests::only_https_urls_without_credentials_or_fragments_are_accepted, outbound::tests::cache_lifetime_honours_max_age_within_the_cap` |
| Embedded transport | optional | When EMBEDDED_CHECKOUT_URL and signing keys are configured, shopping services advertise a transport: embedded binding and the dev.ucp.shopping.checkout.embedded flag, and POST /api/v1/ucp/checkout/:id/embedded-link returns a short-lived handoff URL on the merchant’s hosted page whose token is an Ed25519 signature verifiable with the discovery JWK (404 for an unknown checkout). Unconfigured, neither is advertised and the endpoint returns 501 NOT_CONFIGURED | discovery tests: well_known_ucp_advertises_embedded_transport, embedded_transport_is_not_advertised_without_a_hosted_checkout_url, embedded_transport_is_not_advertised_without_signing_keys, ucp_checkout_embedded_link_points_at_the_hosted_page_with_a_verifiable_token, ucp_checkout_embedded_link_returns_501_when_not_configured; ucp_mapping::tests::embedded_checkout_token_cannot_be_moved_to_another_session |
Negotiation decisions the specification leaves open. Each takes the conservative option: existing clients keep working, failures close, and nothing is advertised that is not served.
- Default mode
off. The specification makes negotiation a business MUST, but before this the REST binding never requiredUCP-Agent, so enforcing it by default would break existing clients and add outbound calls from every replica. Operators opt in;lenientlets them watch whatstrictwould refuse before switching. Discovery does not change with the mode. version_unsupportedbody. The specification shows two shapes. REST uses the error table’s flat{code, content}with422, like the other negotiation errors.- Cache lifetime. Only a 60 s floor is specified. Profiles are capped at 1 h so a changed profile is picked up. Failed fetches are cached for 15 s, so a dead URL does not turn every request into a fetch. At most 256 URLs are cached per replica.
- Limits and timeouts. The specification gives no numbers. Profiles are capped at 256 KiB (the specification requires at least 128 KiB); connect times out after 3 s, the whole fetch after 5 s.
- Order of checks. Authentication comes before negotiation, so unauthenticated callers cannot trigger outbound fetches.
- Fetch-safety failures. A non-HTTPS URL, or a host that resolves to a private or special-use address, is
invalid_profile_url(400). A redirect or any other non-200status isprofile_unreachable(424). A body over the size cap isprofile_malformed(422). - Version scope. A platform version must exactly equal
2026-08-25or asupported_versionskey. Capabilities are served only at2026-08-25, so a platform listing only older capability versions negotiates none, and instrictmode its operations getcapabilities_incompatible. - Lenient on an incompatible operation. The request runs without negotiation and the full envelope is returned, rather than an envelope that omits the operation’s own capability.
UCP 2026-08-25 features not yet implemented
These are part of the current UCP release and are not advertised in discovery. Each is a real gap, not out of scope.
| Capability | Status | Notes |
|---|---|---|
$requestConstraints, PAN / network-token credential split | not_supported_yet | Checkout uses the orchestrator-native payment_intent |
Split payments, payment terms (dev.ucp.common.payment.*) | not_supported_yet | Single instrument per checkout |
dev.ucp.common.payment.ap2_mandates | not_supported_yet | AP2 mandates are verified via payment_intent.ap2_consent_proof, not the UCP extension. Over UCP’s A2A binding a message carrying ap2.checkout_mandate is refused (-32602) rather than completed without the check, and no ap2.merchant_authorization is returned |
Location search / lookup (dev.ucp.common.location.*) | not_supported_yet | No store-location provider contract |
Fractional quantities (measure.json, sale basis) | not_supported_yet | Quantities are integers |
Buyer consent (dev.ucp.consent.*), loyalty, policies, attribution, permalink | not_supported_yet |
UCP A2A binding
UCP’s A2A transport for checkout (specification/shopping/checkout/a2a) is carried by the A2A endpoints: JSON-RPC message/send at /api/v1/a2a/jsonrpc (the A2A 0.3 shape the binding’s examples and transports/a2a_message.json use) and HTTP+JSON / JSON-RPC SendMessage with A2A-Version: 1.0. Every action runs the same run_ucp_* code as the REST and MCP bindings. See consumption guide.
| Capability | Status | Implementation | Tests |
|---|---|---|---|
| Discovery entry | required | ucp.services["dev.ucp.shopping"] lists transport: a2a with the profile version, the overview spec and endpoint {base}/.well-known/agent-card.json, and no schema (UCP defines none for A2A). Always served, so always listed | ucp_a2a_binding_test::discovery_lists_the_a2a_transport_pointing_at_the_agent_card, ucp_profile_schema_test::only_bindings_we_implement_are_listed_as_ucp_transports |
| Agent Card extension | required | capabilities.extensions[] carries uri: https://ucp.dev/2026-08-25/specification/reference with params.capabilities["dev.ucp.shopping.checkout"] = [{version}] (validates against transports/a2a_message.json#/$defs/agent_card), plus a ucp-checkout skill. The extension is not required, so the native envelopes keep working | ucp_a2a_binding_test::the_agent_card_advertises_the_ucp_extension_and_checkout_skill |
| Extension activation | required | A2A-Extensions or X-A2A-Extensions naming the UCP URI is echoed on the response under the same name | ucp_a2a_binding_test::the_activated_extension_is_echoed, ucp_a2a_binding_test::the_http_json_binding_carries_ucp_checkouts_too |
| Actions | required | add_to_checkout (product_id, quantity) and complete_checkout (a2a.ucp.checkout.payment, a2a.ucp.checkout.signals) as the binding defines them; create_checkout, get_checkout, update_checkout, cancel_checkout mirror the MCP tool names with the body under a2a.ucp.checkout (the binding names no other actions). The reply’s DataPart holds the checkout under a2a.ucp.checkout; completion adds order { id, permalink_url }. Replies validate against transports/a2a_message.json#/$defs/message_response and shopping/checkout.json | ucp_a2a_binding_test::a_checkout_built_over_a2a_completes_and_reads_back_over_rest_and_mcp, ucp_a2a_binding_test::create_update_and_cancel_take_a_ucp_checkout_body |
| Session model | required | The business agent generates contextId: it is the checkout id, so a checkout is one resource across REST, MCP and A2A, and a checkout created over REST is driven over A2A by sending its id as contextId (or id in the DataPart). add_to_checkout on a context with no checkout (or a cancelled one) starts a new one | ucp_a2a_binding_test::a_checkout_created_over_rest_is_driven_over_a2a |
| Merchant and currency | required | add_to_checkout carries neither: the merchant is UCP_DEFAULT_MERCHANT_ID (or merchant_id in the DataPart), the currency currency in the DataPart else UCP_CATALOG_CURRENCY, else a currency_required error response | ucp_a2a_binding_test suite (deployment with both set) |
| Platform profile | required | UCP-Agent: profile="..." must be an http(s) URL, else -32001 (data.code: invalid_profile_url), or HTTP 400 INVALID_PROFILE_URL (domain ucp.dev) on HTTP+JSON. The profile is not fetched | ucp_a2a_binding_test::a_missing_platform_profile_is_a_discovery_error |
| Idempotency | required | messageId is the idempotency key: a retried mutating message is answered with the first reply (per replica, last 10,000 messages per process); the same messageId with a different message is -32000 / HTTP 409 IDEMPOTENCY_CONFLICT. Completion also uses the checkout runner’s durable key a2a-ucp:<messageId> | ucp_a2a_binding_test::a_retried_message_is_applied_once |
| Business errors | required | Unknown checkout and validation or payment failures: a normal reply whose a2a.ucp.checkout is a UCP error response (ucp.status: error, messages[]), valid against common/types/error_response.json | ucp_a2a_binding_test::an_unknown_checkout_is_a_ucp_error_response |
| Protocol errors | required | 401/403/409 → -32000 with the HTTP status kept, server faults → -32603; an unknown action, a message with no action, or an AP2 mandate → -32602 | ucp_a2a_binding_test::messages_the_binding_does_not_define_are_invalid_params, ucp_a2a_binding_test::a_retried_message_is_applied_once |
| Tenant isolation | required | Another tenant’s checkout (get, add, cancel, complete) → HTTP 403, -32000, data.reason: TENANT_MISMATCH; add_to_checkout never starts a new checkout over it | ucp_a2a_binding_test::another_tenants_checkout_is_refused |
| Metrics | required | orchestrator_operation_calls_total / orchestrator_operation_latency_seconds with operation="a2a_ucp_<action>" and status = success or the error kind; counters a2a_ucp_replay_total, a2a_ucp_idempotency_conflict_total, a2a_ucp_invalid_profile_total, a2a_ucp_extension_activated_total, a2a_ucp_signals_received_total, a2a_ucp_ap2_mandate_refused_total | ucp_a2a_binding_test::ucp_actions_are_counted_timed_and_errors_labelled_by_kind |
| Cart, catalog and order over A2A | not_supported_yet | UCP defines A2A bindings for checkout only; cart, catalog and order have REST and MCP bindings | conformance review |
| Risk signals | optional | a2a.ucp.checkout.signals is accepted and counted, not forwarded: no provider contract takes it | conformance review |
| Tasks in UCP’s A2A binding | optional | The binding allows Task objects; this agent always replies with a Message | conformance review |
UCP MCP binding
UCP’s MCP transport (services/shopping/mcp.openrpc.json, vendored in crates/orchestrator-http/tests/fixtures/ucp/2026-08-25/services/shopping) is served at POST /api/v1/ucp/mcp, apart from the orchestrator’s native MCP server, because both define create_cart, get_cart and get_order with different arguments. See MCP binding.
| Capability | Status | Implementation | Tests |
|---|---|---|---|
| Discovery entry | required | ucp.services["dev.ucp.shopping"] lists transport: mcp with the profile version, the overview spec, the official OpenRPC schema and endpoint {base}/api/v1/ucp/mcp. The binding is always served, so it is always listed | ucp_mcp_binding_test::discovery_lists_the_mcp_transport_under_dev_ucp_shopping, ucp_profile_schema_test::only_bindings_we_implement_are_listed_as_ucp_transports |
| Tool definitions | required | tools/list is derived from the vendored OpenRPC: one tool per method, inputSchema = the method’s params (with meta inlined), outputSchema = its result schema | ucp_mcp_binding_test::tools_list_matches_the_openrpc_methods_and_param_schemas |
| Checkout tools | required | create_checkout, get_checkout, update_checkout, complete_checkout, cancel_checkout run the same run_ucp_* code as the REST binding; complete_checkout pays with checkout.payment.instruments[0] and returns the checkout with status: completed and order { id, permalink_url } | ucp_mcp_binding_test::checkout_lifecycle_returns_ucp_checkouts_and_an_order |
| Cart and order tools | required | create_cart, get_cart, update_cart, cancel_cart, get_order | ucp_mcp_binding_test::cart_lifecycle_returns_ucp_carts, ucp_mcp_binding_test::checkout_lifecycle_returns_ucp_checkouts_and_an_order |
| Result shape | required | The UCP payload is in structuredContent and serialized in content[0].text; payloads validate against shopping/{checkout,cart,order}.json | every lifecycle test (assert_valid) |
| Request metadata | required | meta["ucp-agent"].profile must be an http(s) URL, else -32001 with data.code: invalid_profile_url and HTTP 400. With UCP_PROFILE_NEGOTIATION enabled the profile is fetched and negotiated as on REST (see Platform profile negotiation) | ucp_mcp_binding_test::a_missing_platform_profile_is_a_discovery_error, ucp_negotiation_test::mcp_reports_negotiation_failures_as_discovery_errors |
| Idempotency | required | complete_checkout, cancel_checkout and cancel_cart require a UUID meta["idempotency-key"] (-32602 otherwise). A completed checkout replays its outcome for the same key; a key already spent on another checkout is -32000 with HTTP 409; cancelling twice returns the canceled resource | ucp_mcp_binding_test::complete_checkout_needs_a_uuid_idempotency_key, ucp_mcp_binding_test::reusing_a_key_for_another_checkout_is_a_conflict, ucp_mcp_binding_test::cancel_checkout_is_idempotent_and_needs_a_key, ucp_mcp_binding_test::cart_lifecycle_returns_ucp_carts |
| Business errors | required | Unknown checkout, cart or order: a result whose structuredContent is a UCP error response (ucp.status: error, messages[] with code: not_found, severity: unrecoverable); validation and payment failures likewise, recoverable | ucp_mcp_binding_test::an_unknown_resource_is_a_ucp_error_response |
| Protocol errors | required | 401/403/409 → -32000, server faults → -32603, each with the matching HTTP status and data.code; bad tool arguments or an unknown tool → -32602; unknown method → -32601; unsupported MCP-Protocol-Version → HTTP 400, -32022 | ucp_mcp_binding_test::a_caller_without_credentials_gets_a_json_rpc_401, ucp_mcp_binding_test::arguments_that_break_the_binding_are_invalid_params, ucp_mcp_binding_test::initialize_ping_and_notifications_follow_mcp |
| Tenant isolation | required | Another tenant’s cart or checkout → HTTP 403, -32000, data.code: TENANT_MISMATCH; another tenant’s order → 403, -32000 | ucp_mcp_binding_test::another_tenants_cart_checkout_and_order_are_refused |
| MCP lifecycle | required | initialize (echoes a supported protocolVersion), ping, server/discover, tools/list, tools/call; notifications get HTTP 202 | ucp_mcp_binding_test::initialize_ping_and_notifications_follow_mcp |
| Metrics | required | Every tool call is counted and timed as orchestrator_operation_calls_total / orchestrator_operation_latency_seconds with operation="ucp_mcp_<tool>" and status = success or the error kind (not_found, tenant_mismatch, invalid_params, invalid_profile_url, …) | ucp_mcp_binding_test::tool_calls_are_counted_timed_and_errors_labelled_by_kind |
| Native MCP server unchanged | required | /api/v1/mcp/message keeps its own tools | ucp_mcp_binding_test::the_native_mcp_server_keeps_its_own_tools |
| Catalog tools | required | search_catalog, lookup_catalog and get_product return UCP products (one variant per catalog item) that validate against shopping/catalog_search.json / catalog_lookup.json; lookup variants carry inputs[] and misses are not_found warnings; an unknown product is a not_found error response. Prices are in context.currency, else UCP_CATALOG_CURRENCY, else a currency_required error response | ucp_mcp_binding_test::search_catalog_returns_ucp_products_priced_in_the_request_or_configured_currency, ucp_mcp_binding_test::lookup_catalog_correlates_inputs_and_reports_misses, ucp_mcp_binding_test::get_product_returns_one_product_or_not_found, config::tests::catalog_currency_is_an_upper_case_iso_code_or_unset |
| Merchant for UCP carts and checkouts | required | UCP has no merchant field: the body’s merchant_id wins, then UCP_DEFAULT_MERCHANT_ID; with neither, merchant_required (MCP error response) / 400 MERCHANT_REQUIRED (REST) | ucp_mcp_binding_test::a_default_merchant_lets_platforms_omit_merchant_id, v1::tests::a_body_merchant_wins_over_the_default, v1::tests::the_default_merchant_fills_in_when_the_body_has_none, v1::tests::without_either_the_error_names_the_setting |
Catalog search filters and pagination | not_supported_yet | Ignored; every match is returned. Variants, options, media and availability beyond one priced variant per item are not modelled by the catalog provider contract | |
| Streaming (SSE) responses | not_supported_yet | Every response is a single JSON body; no text/event-stream |
Fulfillment (UCP)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Fulfillment capability discovery | required | dev.ucp.shopping.fulfillment extends both dev.ucp.shopping.checkout and dev.ucp.shopping.cart in the latest profile, and is flagged in orchestrator.capability_flags["dev.ucp.shopping.fulfillment"] | discovery_test::well_known_ucp_advertises_fulfillment_extension |
| Fulfillment selection command | required | SetFulfillmentSelection cart command quotes shipping/pickup options for a destination and, when selected_option_id is provided, selects an option and adds its amount_minor into total_minor via fulfillment_minor | orchestrator-core fulfillment unit tests; runner.rs |
| REST fulfillment endpoint | required | POST /api/v1/ucp/cart/:id/fulfillment and POST /api/v1/ucp/checkout/:id/fulfillment accept a destination + optional selected_option_id and return the updated UCP cart envelope with a fulfillment object and fulfillment_minor | api_integration_test::ucp_cart_fulfillment_quotes_and_selects_shipping_option |
| Fulfillment wire shape | required | The fulfillment object on cart and checkout responses validates against UCP 2026-08-25 shopping/types/fulfillment.json: typed destinations[] (shipping_address / business_location), option description object and totals[] | ucp_fulfillment_schema_test suite |
| Unknown option rejected | required | Selecting an selected_option_id not present in the quoted options for the method type returns an error, not a silent no-op | orchestrator-http fulfillment tests |
| Fulfillment metrics | required | Fulfillment selection increments cart_fulfillment_selection_total and is recorded under the generic cart_set_fulfillment operation counter/latency histogram | api_integration_test::ucp_cart_fulfillment_quotes_and_selects_shipping_option (/metrics assertions) |
Payment authentication (3DS2)
3DS2 step-up needs the payment provider: it answers authorize with authentication_required and serves the buyer-facing pages (see providers and docs/providers/openapi.yaml). The orchestrator pauses the checkout, shows the step-up to the agent in each protocol’s own shape, and resumes when the result is known.
sequenceDiagram
participant A as Agent / platform
participant O as Orchestrator
participant P as Payment provider
A->>O: complete (UCP REST/MCP, ACP)
O->>P: POST /authorize
P-->>O: authorized=false, authentication_required
O-->>A: UCP complete_in_progress + actions / ACP authentication_required
Note over A,P: Buyer finishes device data collection or the challenge on the provider's page
alt UCP
A->>O: Get Checkout (after action.done)
O->>P: GET /authentication/{id}
P-->>O: completed, result
else ACP
A->>O: complete with authentication_result
end
O->>P: POST /authentication/{id}/authorize
P-->>O: authorized
O-->>A: completed + order
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Provider contract | optional | PaymentProvider gains defaulted supports_authentication, authorize_with_authentication, authentication_status, authorize_authenticated; existing providers are unchanged and never step up. The HTTP adapter reads authentication_required on /authorize and calls GET /authentication/{id} and POST /authentication/{id}/authorize (key <checkout key>:authenticated), only with PAYMENT_AUTHENTICATION_ENABLED=true | payment_authentication_http_test, openapi_spec_test |
| Paused checkout | required | A step-up stops the checkout in AuthenticationPending (TransactionStatus::AuthenticationRequired, PaymentState::AuthenticationPending), records the request and the pause (event store PaymentAuthenticationRequired, checkout_authentication store: memory, file, Postgres migration 0013), keeps the reservation, and answers the idempotency key with the pending step-up | payment_authentication::a_challenge_pauses_checkout_with_the_step_up_and_no_order, payment_authentication::retrying_the_same_key_while_waiting_returns_the_pending_action, payment_authentication::a_pending_authentication_survives_a_restart |
| Resume | required | The provider’s result (read when the checkout is read) or an agent-submitted result resumes the checkout once: authorize, commit, capture, order, receipt; the original key then replays the final outcome. Resumes are claimed in the idempotency store, so replicas cannot place two orders | payment_authentication::the_provider_result_resumes_checkout_to_an_order, payment_authentication::a_submitted_result_resumes_checkout_once |
| Fail closed | required | Outcomes other than authenticated / attempt_acknowledged, an expired pause (15 minutes), a cart changed during authentication, or a step-up from a provider that did not declare 3DS2 support end the checkout unpaid (AuthFailed / TimedOut) | payment_authentication::a_denied_authentication_fails_the_checkout, an_expired_authentication_times_out, a_cart_changed_during_authentication_is_not_charged, step_up_from_a_provider_that_does_not_support_it_fails_closed |
UCP actions | optional | dev.ucp.common.payment.authentication (extends checkout) is advertised only with a 3DS-capable provider. A paused checkout is complete_in_progress with actions["dev.ucp.common.payment.device_data_collection"] and/or ["dev.ucp.common.payment.three_ds_challenge"] (id, config.payment_instrument_id, config.url), payment.instruments[], and the extension listed in ucp.capabilities, on REST, MCP and A2A (shared run_ucp_complete_checkout / run_ucp_get_checkout); Get Checkout completes it (completed + order) or reports payment_failed. Responses validate against the vendored common/payment_authentication.json | ucp_payment_authentication_test, ucp_a2a_binding_test::a_3ds_step_up_is_a_payment_authentication_action_over_a2a |
| Actions follow negotiation | required | With UCP_PROFILE_NEGOTIATION lenient or strict, REST and MCP responses carry the actions only when the platform negotiated dev.ucp.common.payment.authentication; otherwise, and on a lenient fallback, the actions, payment and the extension are removed and the checkout shows its cart status with a recoverable payment_failed message. The A2A binding does not negotiate profiles, so it behaves as off | ucp_negotiation_test::payment_actions_are_sent_when_the_extension_is_negotiated, payment_actions_are_withheld_when_the_extension_is_not_negotiated, a_lenient_fallback_does_not_send_payment_actions_either |
| ACP delegate authentication | optional | Complete Checkout Session (REST and ACP MCP, shared routes/acp.rs) returns the CheckoutSession with status: authentication_required, authentication_metadata and a requires_3ds message; Retrieve shows the same. Completing again with authentication_result resumes it: completed with the order, or 402 payment_declined (Retrieve then shows a payment_declined message). A result with nothing pending is 409 authentication_not_pending | acp_delegate_authentication_test |
| Metrics | required | payment_authentication_challenges_total, payment_authentication_outcome_<outcome>_total (incl. expired), payment_authentication_unsupported_total, payment_authentication_cart_changed_total, time to authenticate as orchestrator_operation_latency_seconds{operation="payment_authentication"}, plus checkout_outcome / checkout_authentication_submit operations | payment_authentication::outcomes_and_time_to_authenticate_are_recorded |
Decisions where the specs leave room (conservative by design):
- UCP extension negotiation. UCP says a business must not emit these actions unless the extension is active for the checkout. With negotiation
lenientorstrictthey are withheld unless negotiated (and on a lenient fallback, which negotiates nothing). With negotiationoff(the default) and on the A2A binding, which does not negotiate, the extension counts as active whenever it is advertised. - Withheld actions. A checkout whose platform did not negotiate the extension cannot finish its 3DS2 step-up, so it is shown at its cart status with a recoverable
payment_failedmessage rather thancomplete_in_progress; completing again with another instrument starts a new checkout attempt. The paused attempt expires after 15 minutes. - UCP action failures. The spec defers the status after a failed authentication to its general fallback rules. A failed, denied or expired authentication leaves the checkout at its cart status with a
payment_failederror (severity: recoverable); the platform may complete again with another instrument. - No
continue_urlfallback. A provider that asks for 3DS2 without declaring support declines the payment rather than handing off withrequires_escalation. - Instrument id. Actions point at the instrument id from the complete request (MCP
payment.instruments[0].id, RESTpayment_instrument_id), echoed underpayment.instruments; without one,instrument_1. - ACP outcomes. Only
authenticatedandattempt_acknowledgedauthorize;informationaland every failure outcome decline.outcome_detailsis required forauthenticated,attempt_acknowledgedandinformational, and an ECI must be one of01,02,05,06,07. - ACP metadata.
authentication_metadatais shown only when the provider sent bothacquirer_detailsanddirectory_server;flow_preferenceis never set, leaving the flow to the issuer. - Timeout. A pause expires after 15 minutes (
OrchestratorFacade::with_payment_authentication_ttl); the inventory reservation is refreshed on resume.
Final checkouts
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Terminal status read back | required | A completed checkout reads back completed with its order (UCP REST, MCP, A2A; ACP REST and MCP); a canceled one canceled. The cart records it (CartStatus::Completed, order_id, CheckoutCompleted event) | checkout_terminal_status_test::a_completed_ucp_checkout_reads_back_completed_on_rest_and_mcp, a_completed_acp_session_reads_back_completed_with_its_order, a2a_add_to_checkout_after_completion_is_refused |
| No changes after the end | required | Updates, adds, cancel and a second complete under a new key are refused for completed and canceled checkouts: UCP REST 409 CHECKOUT_COMPLETED / CART_CANCELED; UCP MCP and A2A an unrecoverable business error checkout_completed / cart_canceled; ACP 409 checkout_session_completed / checkout_session_canceled, cancel after completion 405 session_not_cancelable. A retry with the original key still replays the outcome | checkout_terminal_status_test |
Transport: REST
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Cart commands | required | POST /api/v1/cart/commands accepts create_cart, add_item, update_item_qty, remove_item, apply_adjustment, get_cart, start_checkout | Integration tests, consumption-guide |
| UCP cart shim | required | POST/GET/PUT /api/v1/ucp/cart paths create, retrieve, update, and cancel carts with UCP envelopes | api_integration_test |
| UCP REST binding paths | required | Every operation in UCP services/shopping/rest.openapi.json is reachable relative to the advertised /api/v1/ucp endpoint: /checkout-sessions (+ /{id}, /complete, /cancel), /carts (+ /{id}, /cancel), /catalog/{search,lookup,product}, /orders/{id}. The older /ucp/checkout and /ucp/cart paths remain as aliases | ucp_rest_binding_test suite |
| UCP checkout lifecycle | required | Checkout sessions create/get/update/complete/cancel map to cart + checkout execute, and their envelopes name dev.ucp.shopping.checkout (not cart) as the root capability | ucp_rest_binding_test::checkout_sessions_lifecycle_is_served_at_the_binding_paths |
| Checkout execute | required | POST /api/v1/checkout/execute with cart_id, cart_version, payment_intent, idempotency_key returns transaction result | happy_path, authz tests |
| Payment lifecycle | required | POST /api/v1/payments/{capture,void,refund} with tenant_id, transaction_id, idempotency_key | API tests |
| Payment-handler registry | required | Discovery advertises handlers; GET /api/v1/ucp/payment-handlers lists/gets configured handlers | discovery tests |
| Auth and tenant isolation | required | Bearer auth in production; tenant_id and scope checks; cross-tenant idempotency isolation; carts are stamped with the caller’s tenant at creation and cross-tenant read/mutate/cancel/checkout returns 403 TENANT_MISMATCH; payment delegation and identity linking take the tenant from the auth context, not the body | authz_and_adapters, cross_tenant_idempotency, cart_tenancy, honest_discovery_test::delegate_payment_refuses_a_tenant_the_caller_is_not |
| UCP response bodies | required | Cart, checkout session and order bodies validate against UCP 2026-08-25 shopping/{cart,checkout,order}.json: line item {id,title,price} + totals[], integer totals[] with one subtotal and one total, checkout status vocabulary + links[] + ucp.payment_handlers, order checkout_id, fulfillment, line quantity object and status | ucp_response_schema_test suite |
Transport: A2A / MCP (adapter layer)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| A2A envelope normalization | required | Incoming A2A envelope (capability + payload) normalizes to CheckoutRequest / CartCommand; same authz and idempotency rules apply | a2a_adapter tests |
| A2A-Version negotiation | required | Accept A2A-Version (1.0, 0.3); reject unsupported with supported list | authz_and_adapters, discovery_test |
| Identity-linking envelope normalization | required | Incoming identity-linking envelope normalizes into identity-link request and rejects unsupported capabilities | authz_and_adapters |
| A2A order query envelope | required | POST /api/v1/a2a/orders accepts A2A envelope with payload.order_id and returns order details | api_integration_test |
| MCP dual-era tool server | required | Legacy initialize (2024-11-05/2025-11-25); modern server/discover + MCP-Protocol-Version / _meta for 2026-07-28 | orchestrator-mcp tests |
| MCP Streamable HTTP: Origin | required | 2026-07-28: an Origin header not listed in MCP_ALLOWED_ORIGINS (default: none; * allows any) is refused with 403 and a JSON-RPC error without id, before authentication, on every MCP endpoint. Requests without Origin (server-side agents) are served | mcp_transport_test::a_foreign_origin_is_refused_with_403_by_default, mcp_transport_test::a_listed_origin_is_served, mcp_transport_test::origin_is_checked_before_authentication, mcp_transport_test::a_request_without_origin_is_served, config::tests::mcp_allowed_origins_default_to_none_and_are_validated |
| MCP Streamable HTTP: request headers | required | 2026-07-28: MCP-Protocol-Version must be supported (400, -32022 with supported/requested) and match _meta (400, -32020); Mcp-Method must equal method and Mcp-Name must equal params.name (tools/call, prompts/get) or params.uri (resources/read), Base64 sentinel form decoded; missing or different → 400, -32020 | mcp_transport_test suite |
| MCP Streamable HTTP: responses | required | 2026-07-28: unknown method → 404, -32601; notifications → 202, no body; results carry resultType, list/discovery results ttlMs and cacheScope; GET/DELETE → 405; no Mcp-Session-Id issued | mcp_transport_test::a_modern_unknown_method_is_404_with_32601, mcp_transport_test::a_notification_is_accepted_with_202_and_no_body, mcp_transport_test::a_conforming_modern_request_is_served_as_a_complete_cacheable_result, mcp_transport_test::get_and_delete_are_405 |
| MCP Streamable HTTP: back-compat | required | 2025-11-25, 2024-11-05 and version-less requests need no Mcp-Method/Mcp-Name, keep HTTP 200 for unknown methods and undecorated results; a client Mcp-Session-Id is ignored | mcp_transport_test::legacy_clients_need_no_mcp_method_or_name, mcp_transport_test::a_legacy_unknown_method_keeps_its_200, mcp_transport_test::a_session_id_from_a_legacy_client_is_ignored |
| MCP tool definitions | required | All facade operations exposed as MCP tools with JSON Schema input definitions, including set_fulfillment_selection (quote-only when selected_option_id is omitted). See MCP binding | tools::tests::tools_list_includes_set_fulfillment_selection, tools::tests::set_fulfillment_selection_with_an_option_prices_the_cart |
| MCP resource definitions | required | order://{id} and cart://{id} resources readable via resources/read | orchestrator-mcp tests |
| MCP endpoint in discovery | required | /.well-known/ucp → orchestrator.mcp_endpoint and orchestrator.mcp_supported_versions | discovery tests |
| A2A 1.0 Agent Card | required | GET /.well-known/agent-card.json carries every required AgentCard field, three interfaces (HTTP+JSON 1.0 at /api/v1/a2a, JSONRPC 1.0 and JSONRPC 0.3 at /api/v1/a2a/jsonrpc), capabilities.streaming: true, only the skills this deployment can run, and Bearer securitySchemes/securityRequirements when auth is required; linked from /.well-known/ucp as orchestrator.a2a_agent_card | a2a_binding_test::the_agent_card_has_every_required_field, a2a_binding_test::the_agent_card_lists_only_skills_this_deployment_can_run, a2a_binding_test::the_agent_card_declares_bearer_auth_when_the_deployment_requires_it |
| A2A 1.0 SendMessage (HTTP+JSON) | required | POST /api/v1/a2a/message:send requires A2A-Version: 1.0, takes a ROLE_USER message whose DataPart carries a capability envelope, runs it through the same normalizers and policy as /a2a/*, and replies application/a2a+json with a ROLE_AGENT message (contextId preserved). Errors are google.rpc.Status with ErrorInfo (VERSION_NOT_SUPPORTED, INVALID_PARAMS, UNSUPPORTED_OPERATION, TASK_NOT_FOUND) | a2a_binding_test suite |
| A2A task operations | required | The agent never creates tasks, so GetTask, CancelTask and SubscribeToTask (POST as the spec text says, GET as a2a.proto says) return 404 TASK_NOT_FOUND, and ListTasks (GET /api/v1/a2a/tasks) is always empty | a2a_binding_test::tasks_are_never_created_so_task_operations_report_not_found, a2a_binding_test::list_tasks_is_always_empty |
A2A streaming (SendStreamingMessage) | required | POST /api/v1/a2a/message:stream (and JSON-RPC SendStreamingMessage / 0.3 message/stream) runs the same operation as SendMessage and answers text/event-stream with one data: event holding a StreamResponse {"message": ...}, then closes: A2A 1.0 §3.1.2 says a Message stream “MUST contain exactly one Message object and then close immediately”, so no task lifecycle is needed. Failures are found before the stream opens and answered as ordinary error responses (A2A 1.0 defines no in-stream error for HTTP+JSON). Metrics: operation="a2a_send_streaming_message", gauge orchestrator_open_streams{stream="a2a_message_stream"} | a2a_binding_test::send_streaming_message_streams_exactly_one_agent_message_then_closes, a2a_binding_test::send_streaming_message_reports_failures_before_the_stream_opens, a2a_binding_test::streams_are_counted_timed_and_tracked_as_open_streams, a2a_binding_test::jsonrpc_send_streaming_message_wraps_the_one_event_in_a_response |
| A2A JSON-RPC binding | required | POST /api/v1/a2a/jsonrpc: A2A 1.0 methods (SendMessage, SendStreamingMessage, GetTask, ListTasks, CancelTask, SubscribeToTask, push config methods, GetExtendedAgentCard) with A2A-Version: 1.0, and the 0.3 methods (message/send, message/stream, tasks/*) with 0.3 message shapes when no version is sent. Codes per A2A 1.0 §5.4: -32001 task not found, -32003 push notifications, -32004 unsupported operation, -32009 version, plus JSON-RPC -32700/-32600/-32601/-32602. Metrics: operation="a2a_jsonrpc_<method>" | a2a_binding_test::jsonrpc_send_message_answers_with_an_agent_message, a2a_binding_test::jsonrpc_speaks_the_a2a_0_3_message_shape_on_message_send, a2a_binding_test::jsonrpc_errors_use_the_a2a_error_codes, a2a_binding_test::jsonrpc_calls_are_counted_by_method_and_error_kind |
| A2A push notifications | not_supported_yet | Push configs are keyed by task and this agent creates none; declared pushNotifications: false, and every /tasks/{id}/pushNotificationConfigs operation answers 400 PUSH_NOTIFICATION_NOT_SUPPORTED (§3.3.4) | a2a_binding_test::push_notification_configs_are_not_supported |
| A2A extended agent card | not_supported_yet | Everything is on the public card; declared extendedAgentCard: false, and GET /api/v1/a2a/extendedAgentCard answers 400 UNSUPPORTED_OPERATION | a2a_binding_test::the_extended_agent_card_is_not_offered |
| A2A gRPC binding | not_supported_yet | Needs a protobuf/gRPC server stack beside axum for no new capability; HTTP+JSON and JSON-RPC cover the same operations | conformance review |
| A2A card signatures | not_supported_yet | Needs RFC 8785 canonicalization with proto3 default-stripping over the card, which no test vector pins down; the card is served over TLS and signed responses carry RFC 9421 signatures | conformance review |
| Delegated capability in handoff | optional | A2AHandoffProfile carries protocol, selected profile version, delegated_capability, and supported profile versions | adapters.rs, authz_and_adapters |
ACP (Agentic Commerce Protocol)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| API-Version header | required | Require API-Version: 2026-04-17; mismatch/missing returns error with supported_versions | api_integration_test |
| Mandatory Idempotency-Key header | required | Every mutating ACP route (checkout_sessions create/update/complete/cancel, delegate_payment, carts create/update/cancel) requires a non-empty Idempotency-Key header; missing/blank returns 400 with code: idempotency_key_required; the key is echoed on success | acp_rest_binding_test::headers_are_required_and_errors_are_acp_errors, api_integration_test::acp_delegate_payment_requires_an_idempotency_key |
| Checkout session bodies (2026-04-17) | required | POST /checkout_sessions (201), GET and POST /checkout_sessions/{id} (update; PUT kept) take CheckoutSessionCreateRequest / CheckoutSessionUpdateRequest and return CheckoutSession, all validated against the vendored 2026-04-17 schema; items are { id } units; tenant from authentication, merchant UCP_DEFAULT_MERCHANT_ID; earlier non-ACP fields are invalid_payload | acp_rest_binding_test::create_returns_201_and_a_checkout_session, acp_rest_binding_test::get_and_update_return_checkout_sessions, acp_rest_binding_test::a_pre_2026_04_17_body_is_an_invalid_request, acp_rest_binding_test::without_a_default_merchant_a_session_is_refused, acp_rest_binding_test::the_tenant_comes_from_authentication |
| Complete session | required | POST .../complete takes CheckoutSessionCompleteRequest (payment_data.handler_id, instrument.credential.token), pays the session total under the Idempotency-Key, and returns CheckoutSessionWithOrder; same key replays, a key spent on another session is 422 idempotency_conflict | acp_rest_binding_test::complete_returns_the_session_with_its_order_and_replays_by_key |
| Cancel session | required | Optional CancelSessionRequest body; a canceled session is 405 session_not_cancelable | acp_rest_binding_test::cancel_takes_an_optional_body_and_refuses_a_second_cancel |
| ACP errors | required | Checkout session and cart failures are ACP Error bodies (type, code, message, param) with the matching status (404 session_not_found, 403 forbidden, 405, 422, …) | acp_rest_binding_test::headers_are_required_and_errors_are_acp_errors, acp_rest_binding_test::an_unknown_session_is_404_session_not_found |
| ACP REST metrics | required | orchestrator_operation_calls_total / _latency_seconds with operation="acp_rest_<operation>", status = success or the ACP error code, plus the acp_checkout_session_*_total / acp_cart_*_total counters | acp_rest_binding_test::rest_calls_are_counted_timed_and_errors_labelled_by_code |
| Delegate payment | optional | POST /api/v1/acp/delegate_payment calls the configured PSP delegation adapter and returns the PSP’s delegated token (never the caller’s own); returns 501 with code: NOT_CONFIGURED when PAYMENT_DELEGATION_BASE_URL is unset | honest_discovery_test::delegate_payment_returns_the_psp_token_when_configured, honest_discovery_test::delegate_payment_returns_501_when_no_psp_delegation_is_configured |
| Cart Capability | required | POST/GET/PUT /api/v1/acp/carts (+ POST .../cancel) take CartCreateRequest / CartUpdateRequest and return Cart (validated against the vendored schema.cart.json), cart_-prefixed ids, priced in UCP_CATALOG_CURRENCY (400 currency_required when unset); PUT replaces the contents; a canceled cart is 404 not_found | acp_rest_binding_test::cart_lifecycle_uses_the_acp_cart_shapes, acp_rest_binding_test::a_cart_needs_a_configured_currency |
| Discovery document | required | GET /.well-known/acp.json returns protocol (name/version/supported_versions), api_base_url, transports (rest, mcp), and capabilities.services with checkout and carts; delegate_payment appears only when a delegation adapter is configured | discovery_test::well_known_acp_returns_200_and_manifest, honest_discovery_test::acp_discovery_hides_delegate_payment_until_a_psp_is_configured |
| Discovery advertisement (UCP) | required | /.well-known/ucp → orchestrator.acp_discovery points at /.well-known/acp.json (the 2026-04-08 profile still lists a transport: acp binding) | discovery_test::discovery_advertises_acp_signing_and_payment_handlers |
| ACP MCP transport binding: tools | required | POST /api/v1/acp/mcp serves exactly the five tools of the vendored spec/2026-04-17/openrpc/openrpc.agentic_checkout.json; inputSchema = the OpenRPC params with every $ref bundled into the tool’s $defs, outputSchema = the result schema. Delegate payment stays REST-only, as the binding scopes it out | acp_mcp_binding_test::tools_list_matches_the_openrpc_methods_with_bundled_schemas, acp_mcp_binding_test::the_input_schemas_accept_the_official_examples |
| ACP MCP transport binding: lifecycle | required | create, get, update, complete and cancel run the shared run_acp_* code of the REST binding; results are the ACP CheckoutSession / CheckoutSessionWithOrder (validated against the vendored 2026-04-17 schema), also given as MCP structuredContent and content[]; sessions are readable over REST | acp_mcp_binding_test::checkout_lifecycle_returns_acp_sessions_and_an_order, acp_mcp_binding_test::a_session_created_over_mcp_is_readable_over_rest, acp_mcp_binding_test::cancel_is_idempotent_and_takes_an_optional_payload |
| ACP MCP transport binding: inputs | required | meta.api_version negotiated like API-Version; payload validated against the ACP request schema (invalid_request / invalid_payload with a JSONPath param); merchant from meta.merchant_id, else UCP_DEFAULT_MERCHANT_ID, else merchant_required | acp_mcp_binding_test::a_payload_that_breaks_the_acp_schema_is_an_invalid_request, acp_mcp_binding_test::an_unsupported_api_version_lists_the_supported_ones, acp_mcp_binding_test::without_a_merchant_the_session_is_refused |
| ACP MCP transport binding: idempotency | required | complete replays by meta.idempotency_key, or by session when absent; a key spent on another session is idempotency_conflict; cancel is idempotent | acp_mcp_binding_test::completing_again_with_the_same_key_replays_the_order, acp_mcp_binding_test::completing_without_a_key_is_still_idempotent_per_session, acp_mcp_binding_test::a_key_spent_on_another_session_is_an_idempotency_conflict |
| ACP MCP transport binding: errors and tenancy | required | ACP errors are JSON-RPC -32000 with a schema-valid ACP Error in data; malformed calls -32602; another tenant’s session forbidden; MCP server auth failures are HTTP 401 | acp_mcp_binding_test::an_unknown_session_is_session_not_found, acp_mcp_binding_test::malformed_tool_calls_are_invalid_params, acp_mcp_binding_test::another_tenants_session_is_forbidden, acp_mcp_binding_test::a_caller_without_credentials_is_refused_at_the_mcp_server |
| ACP MCP transport binding: discovery | required | /.well-known/acp.json lists transports: ["rest", "mcp"] and validates against the vendored DiscoveryResponse schema; the endpoint URL is out of band, as ACP specifies | acp_mcp_binding_test::acp_discovery_lists_the_mcp_transport |
| ACP MCP transport binding: metrics | required | orchestrator_operation_calls_total / _latency_seconds with operation="acp_mcp_<tool>", status = success or the ACP error code | acp_mcp_binding_test::tool_calls_are_counted_timed_and_errors_labelled_by_code |
| Delegate payment body (2026-04-17) | not_supported_yet | POST /api/v1/acp/delegate_payment keeps its earlier token-exchange body. The 2026-04-17 DelegatePaymentRequest carries raw card data (payment_method.number) and an allowance, which is the PSP’s vault API: a merchant-side orchestrator should not receive card numbers | conformance review |
| AP2 / MPP on ACP complete | not_supported_yet | 2026-04-17 PaymentData has no room for the earlier payment_method_type, ap2_consent_proof and mpp_* fields, so ACP completes pay by handler token only; AP2 and MPP stay on /api/v1/checkout/execute | conformance review |
| Idempotent replay of create/update/cancel | not_supported_yet | Idempotency-Key is required and echoed on every mutating route, but only complete replays a stored outcome (Idempotent-Replayed is never sent); a retried create makes a new session | conformance review |
| Feed API | not_supported_yet | Agent-hosted feed push is out of scope for merchant middleware | conformance review |
| Native Orders enrichment | not_supported_yet | ACP’s order-enrichment fields (carrier tracking, fulfillment events pushed back into ACP orders) are not implemented; order data remains orchestrator-native via /api/v1/orders and /api/v1/ucp/orders | conformance review |
| Delegate authentication (3DS2), seller side | optional | See Payment authentication (3DS2): authentication_required + authentication_metadata + requires_3ds on REST and ACP MCP, then complete with authentication_result; intervention_types: ["3ds"] in acp.json only with a 3DS-capable payment provider | acp_delegate_authentication_test |
Delegate authentication provider API (/delegate_authentication) | not_supported_yet | The authentication-provider endpoints (create / authenticate / retrieve an authentication session with raw card data) belong to the agent’s authentication provider, typically a PSP; the orchestrator is the seller and does not proxy card numbers | conformance review |
Decisions where the specs are silent
Choices made where MCP 2026-07-28 or ACP 2026-04-17 leave the behaviour open, each the conservative one (fail closed, keep existing clients working, advertise only what is served):
| Topic | Decision |
|---|---|
MCP request without Origin | Served: server-side agents send none. A present Origin must be listed in MCP_ALLOWED_ORIGINS (default: none); same-origin is not trusted, as DNS rebinding controls Host |
MCP request without MCP-Protocol-Version | Treated as a pre-2025-06-18 client and served as before (the spec allows it), unless _meta names a version, which is 400, -32020 |
| MCP notification headers | Not defined by the revision: a notification is held only to the headers it sends |
| MCP cache hints | ttlMs: 300000, cacheScope: "private" on list/discover results (they depend on credentials); ttlMs: 0 on resources/read |
| ACP merchant | ACP has no merchant field: meta.merchant_id (MCP only), else UCP_DEFAULT_MERCHANT_ID, else merchant_required |
| ACP cart currency | ACP lets the seller choose: UCP_CATALOG_CURRENCY, else currency_required |
| ACP canceled cart | ACP carts have no status, so a canceled cart is 404 not_found |
ACP MCP complete without meta.idempotency_key | The session id is the key (acp-mcp-complete:{id}), so a retry replays instead of paying twice |
| ACP MCP results | The CheckoutSession is the result (ACP) and is repeated as structuredContent and content[] (MCP) |
| ACP payload fields without a backend | fulfillment_details, selected_fulfillment_options, discounts, intent_trace, buyer on create/update are validated, then ignored; purchase-order payments are unsupported_payment_method |
| ACP payment declined | 402, processing_error / payment_declined |
| ACP REST session update | POST as specified; the earlier PUT stays as an alias |
Order Query API
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Order retrieval by ID | required | GET /api/v1/orders/:id returns order with tenant isolation | api_integration_test |
| Tenant-scoped order listing | required | GET /api/v1/orders returns orders for the authenticated tenant, most recent first | api_integration_test |
| OrderStore list_by_tenant | required | All store implementations (InMemory, FileBacked, Postgres) support list_by_tenant | order.rs tests |
Webhook Event Delivery
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Webhook registration | required | POST /api/v1/webhooks registers a webhook with URL, secret, and optional event filter | api_integration_test |
| Webhook listing | required | GET /api/v1/webhooks returns tenant-scoped webhook registrations | api_integration_test |
| Webhook unregistration | required | DELETE /api/v1/webhooks/:id removes a webhook | api_integration_test |
| HMAC-SHA256 signing | required | WebhookDeliverer signs payloads with X-Webhook-Signature using the registration secret | webhooks.rs HMAC test |
| RFC 9421 signed webhooks (UCP) | required when signing keys are configured | With UCP signing keys configured, every delivery also carries Content-Digest and an RFC 9421 Signature-Input/Signature (sig1) by the active key, covering @method, @authority, @path, @query (when present), content-digest and content-type. It verifies against the discovery keys[] JWK. A delivery that cannot be signed is not sent and counts webhook_signing_failure_total | signed_webhooks::webhooks_carry_signatures_verifiable_with_the_published_keys, ucp_signing::a_signed_webhook_verifies_under_the_published_keys, ucp_signing::a_signed_webhook_covers_the_query_when_the_url_has_one, webhook_delivery_metrics_test::a_configured_signer_adds_message_signatures_beside_the_hmac, webhook_delivery_metrics_test::a_delivery_that_cannot_be_signed_is_not_sent_unsigned |
| Outbox delivery via webhooks | required | WebhookDeliverer implements OutboxDeliverer and delivers to matching registrations of the tenant that owns the event; the topic lookup is tenant-scoped in every store | webhooks.rs::a_topic_lookup_never_crosses_tenants, webhook_delivery_metrics_test::another_tenants_endpoint_is_not_called |
Catalog
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Catalog item lookup | required | GET /api/v1/catalog/items/:id and POST /api/v1/ucp/catalog/product return catalog item details | api_integration_test |
| Catalog batch lookup | required | POST /api/v1/ucp/catalog/lookup returns found products and UCP messages for misses | api_integration_test |
| Catalog search | required | POST /api/v1/ucp/catalog/search returns matching products through provider-backed search | api_integration_test, catalog_http_test |
| Discovery capability | required | Latest discovery advertises dev.ucp.shopping.catalog.lookup and dev.ucp.shopping.catalog.search | discovery_test |
AP2 (Agent Payments Protocol)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Payment intent fields | required | CheckoutRequest.payment_intent accepts payment_handler_id and ap2_consent_proof; validation rejects empty handler_id when provided | contract.rs, validation.rs, authz_and_adapters |
| AP2 metadata extraction | required | extract_ap2_metadata(request) returns handler_id and consent_proof for logging/audit without PII | adapters.rs, pii.rs, authz_and_adapters |
| Mandate/credential verification (strict mode) | required when AP2 mode enabled | When AP2_STRICT=1: verify structured consent proof fields, signature presence, issuer trust policy, expiry, and payment_handler binding; reject on invalid or missing required artifacts | ap2_verification tests |
| AP2 0.2 HNP open/closed mandates | required | Open mandate (mandate.checkout.open.1) + closed payment mandate with amount/currency constraints; fail closed on constraint mismatch | authz_and_adapters |
| Replay protection for mandates | required | Mandate ID deduplication prevents AP2 consent proof replay until mandate expiry | authz_and_adapters replay test; runtime MandateDedupeStore |
MPP (Machine Payments Protocol)
| Capability | Status | Acceptance Criteria | Evidence |
|---|---|---|---|
| Payment intent MPP fields | required | CheckoutRequest.payment_intent accepts payment_method_type="mpp", mpp_method, and mpp_intent; MPP credentials are supplied in token_or_reference | contract.rs, validation.rs, authz_and_adapters |
| MPP metadata extraction for audit | required | Adapter extraction provides method/intent metadata without exposing credential payloads in logs | adapters.rs, authz_and_adapters |
| MPP capability flag in discovery | required | Discovery capability flags include dev.ucp.payments.mpp=true for staged rollout signaling | ucp_mapping.rs, discovery_test |
| Downstream payment adapter forwarding hints | optional | HTTP payment adapter forwards MPP context to downstream payment services (X-Payment-Method, X-Mpp-Method, X-Mpp-Intent) when payment method is MPP | integration-adapters/src/payment.rs, adapters_http_test |
| Payment challenge binding primitives | optional | MppChallenge binds with HMAC-SHA256 over the published draft-httpauth-payment vectors; credentials and receipts encode/decode as base64url JCS | orchestrator-api/src/mpp.rs, mpp_wire |
402 Payment challenge on checkout | optional | With MPP_CHALLENGE_SECRET set, an MPP POST /api/v1/checkout/execute without a credential gets 402, Cache-Control: no-store, an RFC 9457 payment-required problem, and WWW-Authenticate: Payment. The challenge is bound to realm, method, intent, a charge request (amount string, lowercase currency), expires, the body’s RFC 9530 digest, header="Payment-Authorization" and a nonce in opaque. Unconfigured, MPP checkouts are not challenged | mpp_checkout_test::an_mpp_checkout_without_a_credential_is_challenged, mpp_checkout_test::without_a_challenge_secret_mpp_checkout_is_not_challenged, mpp_checkout_test::other_payment_methods_are_not_challenged |
| Credential verification and single use | optional | The credential is read only from Payment-Authorization (one header, else 400). Its echoed challenge must match this request and verify under the secret; an unexpired, unused id is claimed once in the persisted replay store. Refusals are 402 with a fresh challenge: malformed-credential, invalid-challenge (edited, other body, reused), payment-expired, verification-failed (provider refused the proof) | mpp_checkout_test::a_credential_is_accepted_only_once, …::a_credential_cannot_pay_for_a_different_request, …::an_edited_challenge_is_refused, …::an_expired_challenge_is_refused, …::a_malformed_credential_is_refused_with_a_fresh_challenge, …::a_declined_proof_is_refused_with_a_fresh_challenge |
Payment-Receipt | optional | A completed MPP checkout carries Payment-Receipt (status: success, method, RFC 3339 timestamp, reference, challengeId) and Cache-Control: private; errors never carry one. Metrics: mpp_challenge_issued_total, mpp_receipt_issued_total, mpp_credential_rejected_<problem>_total, mpp_credential_check operation latency | mpp_checkout_test::a_valid_credential_completes_checkout_with_a_receipt, mpp_checkout_test::challenges_receipts_and_rejections_are_counted |
| MPP over MCP: payment required | optional | With MPP_CHALLENGE_SECRET set, an execute_checkout tools/call on the native MCP server (/api/v1/mcp/message) whose payment_intent.payment_method_type is mpp and that carries no params._meta["org.paymentauth/credential"] gets JSON-RPC error -32042 Payment Required with data.httpStatus: 402, data.challenges[] (the challenge as a JSON object, no header) and data.problem (RFC 9457). The challenge’s digest is the RFC 9530 digest of the JCS-canonical tool arguments. Unconfigured, or for other payment methods and tools, nothing is challenged | mpp_mcp_test::an_mpp_tool_call_without_a_credential_is_payment_required, …::without_a_challenge_secret_an_mpp_tool_call_is_not_challenged, …::other_payment_methods_are_not_challenged, …::other_tools_ignore_a_credential |
| MPP over MCP: credential and receipt | optional | The credential is the draft’s JSON object in params._meta["org.paymentauth/credential"], checked and claimed once exactly as over HTTP and handed to the payment provider base64url-encoded. Refusals are -32042 with a fresh challenge (malformed-credential, invalid-challenge, payment-expired); a proof the provider refuses is -32043 Payment Verification Failed with a fresh challenge. A completed checkout carries result._meta["org.paymentauth/receipt"] (status, method, timestamp, reference, challengeId) beside the 2026-07-28 server _meta. Metrics: the mpp_* counters plus mpp_mcp_challenge_issued_total, mpp_mcp_receipt_issued_total, mpp_mcp_credential_rejected_<problem>_total, mpp_mcp_credential_check latency | mpp_mcp_test::a_valid_credential_completes_checkout_with_a_receipt_in_meta, …::a_credential_is_accepted_only_once, …::a_credential_cannot_pay_for_different_arguments, …::a_wrong_amount_is_refused, …::a_wrong_realm_is_refused, …::an_expired_challenge_is_refused, …::a_malformed_credential_is_refused_with_a_fresh_challenge, …::a_declined_proof_is_verification_failed_with_a_fresh_challenge, …::a_modern_client_gets_the_receipt_beside_the_server_meta, …::mcp_challenges_receipts_and_rejections_are_counted_per_transport |
| MPP over MCP: capability advertisement | not_supported_yet | server/discover and tools/list do not advertise MPP: no published MPP MCP transport source defines a capability or discovery key, so the -32042 challenge is the only signal | conformance review |
| MPP on UCP (REST, MCP, A2A complete) | not_supported_yet | UCP 2026-08-25 pays through payment handlers and instruments, and no published handler specification defines MPP; complete_checkout takes no Payment credential | conformance review |
| MPP on ACP (REST and MCP complete) | not_supported_yet | ACP 2026-04-17 PaymentData carries a handler token only and defines no MPP instrument or credential field | conformance review |
| MPP on A2A (native checkout and SendMessage) | not_supported_yet | Neither A2A 1.0, AP2 0.2 nor the MPP drafts define a DataPart or metadata key for MPP challenges, credentials or receipts | conformance review |
Acceptance Criteria (Summary)
- Discovery: A client can GET
/.well-known/ucpand learn UCP profile, ACP/MCP/A2A/AP2 version metadata, signing keys, and payment handlers; every advertised capability is implemented. - REST / UCP / ACP: Cart, checkout lifecycle, catalog, order, payment, and ACP session/cart endpoints behave as documented; auth and tenant checks enforced; ACP POST routes require
Idempotency-Key; ACP discovery is published at/.well-known/acp.json. - A2A/MCP: Adapter layer converts A2A (and MCP dual-era) requests into domain types and executes via the same facade; policy and idempotency unchanged.
- AP2 0.2: Payment intent carries AP2 fields; strict mode verifies closed and optional open (HNP) mandates with constraint binding.
- MPP: Payment intent can carry MPP method metadata; discovery advertises MPP capability flag; with a challenge secret configured, REST checkout runs the
402Paymentchallenge / credential / receipt flow and the native MCPexecute_checkouttool runs the MPP MCP transport (-32042,_metacredential and receipt).
Machine-Readable Conformance (for CI)
Conformance is asserted by the following tests; CI runs them in the “Conformance (discovery, REST binding, signatures, A2A, AP2, MPP)” step:
cargo test -p orchestrator-http --test discovery_test— discovery endpoint, advertised capabilities, capability-route parity, A2A/ACP routescargo test -p orchestrator-http --test ucp_negotiation_test— platform profile negotiation on the UCP REST and MCP bindings: errors, intersection, caching, metricscargo test -p orchestrator-http --test ucp_profile_schema_test—/.well-known/ucpvalidates against the official UCP2026-08-25business profile schema; profile rules the schema cannot expresscargo test -p orchestrator-http --test ucp_response_schema_test— cart, checkout and order bodies validate against the official UCP schemascargo test -p orchestrator-http --test ucp_fulfillment_schema_test— fulfillment objects validate against the official UCP fulfillment schemacargo test -p orchestrator-http --test ucp_rest_binding_test— every UCP REST binding operation is routed at its spec pathcargo test -p orchestrator-http --test ucp_mcp_binding_test— UCP’s MCP binding: tools match the official OpenRPC, results validate against the UCP schemas, idempotency, tenancy, error mapping, discovery, metricscargo test -p orchestrator-http --test ucp_signature_testandcargo test -p orchestrator-api --test ucp_signing— RFC 9421 signatures, Content-Digest, ES256/Ed25519, UCP error codes, RFC 9421 test vectorcargo test -p orchestrator-api --test signed_webhooks— webhook deliveries verify against the discovery JWKscargo test -p orchestrator-http --test a2a_binding_test— A2A 1.0 Agent Card,SendMessage,SendStreamingMessageover SSE, the JSON-RPC binding, task operations, error shapecargo test -p orchestrator-http --test ucp_a2a_binding_test— UCP’s A2A checkout binding: envelopes validate against the officialtransports/a2a_message.json, checkouts againstshopping/checkout.json; idempotency, tenancy, error mapping, discovery, metricscargo test -p orchestrator-api --test authz_and_adapters— authz, AP2 0.2 HNP, A2A version negotiation, AP2 strict modecargo test -p orchestrator-http --test mpp_checkout_test— MPP402challenge, credential binding and single use, receipts, problem typescargo test -p orchestrator-http --test mpp_mcp_test— MPP over MCP:-32042challenge,_metacredential, single use,-32043,_metareceipt, per-transport metricscargo test -p orchestrator-http --test ucp_payment_authentication_test— UCP Payment Authentication actions validate against the official schema; discovery, resume, failurecargo test -p orchestrator-http --test acp_delegate_authentication_test— ACPauthentication_required,authentication_result,3dsintervention advertisementcargo test -p orchestrator-http --test checkout_terminal_status_test— completed and canceled checkouts read back terminal and refuse changes on UCP REST/MCP/A2A and ACP REST/MCPcargo test -p orchestrator-api --test payment_authentication— 3DS2 pause, idempotent retry, resume, fail-closed paths, restartcargo test -p orchestrator-mcp— MCP dual-era discover / version errors / legacy initializecargo test -p orchestrator-http --test acp_rest_binding_test— ACP REST checkout sessions and carts against the2026-04-17schemas: bodies, errors, idempotency, tenancy, metricscargo test -p orchestrator-http --test acp_mcp_binding_test— ACP’s MCP binding: tools match the official OpenRPC, results and errors validate against the ACP2026-04-17schemas, idempotency, tenancy, discovery, metricscargo test -p orchestrator-http --test mcp_transport_test— MCP2026-07-28Streamable HTTP rules (Origin,Mcp-Method/Mcp-Name, status codes, back-compat) on every MCP endpoint
CI must pass these before claiming alignment in release notes.
Runbooks
Operational procedures for a running orchestrator. Each one says when it applies, how to diagnose the problem, and what to do about it.
| Runbook | Use it when |
|---|---|
| Retries and outbox | Webhooks are late or missing, the outbox is growing, or you need to tune delivery retries and backoff |
| Dead-letter handling | Messages exhausted their delivery attempts and need to be inspected and replayed |
| Reconciliation | The orchestrator’s payment state and your payment provider’s state may have drifted apart |
The operations endpoints these runbooks use (/api/v1/ops/outbox/process, /api/v1/ops/dead-letter, /api/v1/ops/dead-letter/replay, /api/v1/ops/reconciliation) are described in the consumption guide. How the outbox, dead-letter and inbox fit together is shown in the architecture page.
Runbook: Outbox retries and webhook delivery
Overview
The orchestrator writes external side effects (for example order.created) to an
outbox as part of committing a checkout. A background processor runs inside the
server process and drains that outbox, delivering each message to every webhook
registration whose topic filter matches.
Since v0.9.0 you do not need to call the processor yourself. Earlier releases
exposed process_outbox_once but never ran it, so in a deployed server the outbox
grew without bound and no webhook was ever delivered.
flowchart LR
Checkout[execute_checkout] -->|enqueue| Outbox[(outbox)]
Processor[Background processor] -->|dequeue| Outbox
Processor -->|POST + HMAC + RFC 9421 when keys are set| Subscriber[Your webhook endpoint]
Processor -->|attempts exhausted| DeadLetter[(dead_letter)]
DeadLetter -->|replay| Outbox
Configuration
| Setting | Env var | Default | Meaning |
|---|---|---|---|
outbox.interval_ms | OUTBOX_INTERVAL_MS | 500 | Pause between polls when the queue is empty |
outbox.batch_size | OUTBOX_BATCH_SIZE | 32 | Messages handled per wake-up |
outbox.max_attempts | OUTBOX_MAX_ATTEMPTS | 5 | Delivery attempts before dead-lettering |
outbox.drain_timeout_secs | OUTBOX_DRAIN_TIMEOUT_SECS | 10 | How long shutdown waits for the queue to drain |
outbox.retry_backoff_ms | OUTBOX_RETRY_BACKOFF_MS | 500 | Pause after a failed delivery, doubled per attempt |
outbox.max_retry_backoff_secs | OUTBOX_MAX_RETRY_BACKOFF_SECS | 30 | Ceiling for that pause |
When the queue is non-empty the processor keeps working without pausing, so
interval_ms only controls idle polling. A failed delivery is the exception: it
pauses for retry_backoff_ms doubled per attempt (capped), so an endpoint that is
down is retried slowly instead of spending every attempt within milliseconds and
dead-lettering messages that a later retry would have delivered.
Multi-replica operation
The Postgres outbox claims with FOR UPDATE SKIP LOCKED, so every replica can
run its own processor without delivering the same message twice. No leader
election or singleton deployment is required.
A claim is a lease, not a delete: the row keeps a locked_until stamp and is only
removed once delivery has been acknowledged, so a replica that dies mid-delivery
leaves the message for whoever claims it after the lease expires (60s). The
trade-off is at-least-once delivery — a subscriber that received the request just
before a crash can see it again, so webhook handlers should be idempotent on
X-Webhook-Id.
Delivery is scoped per tenant: an event is offered only to the webhooks registered by the tenant that owns it.
Shutdown behaviour
On SIGTERM or SIGINT the server stops accepting new work, signals the
processor to stop, and waits up to drain_timeout_secs for the queue to empty. If
the drain times out, a warning is logged and the remaining messages stay in the
outbox for the next process (or another replica) to pick up. Nothing is lost.
Metrics
| Metric | Type | What it tells you |
|---|---|---|
orchestrator_queue_depth{queue="outbox"} | gauge | Current backlog. Sustained growth means downstream failure or insufficient throughput. |
orchestrator_queue_depth{queue="dead_letter"} | gauge | Messages that exhausted their attempts and need investigation. |
orchestrator_delivery_attempts{operation="outbox_delivery"} | histogram | Attempts consumed before a message settled, split by status. |
orchestrator_events_total{name="webhook_delivery_success_total"} | counter | Deliveries accepted by a subscriber. |
orchestrator_events_total{name="webhook_delivery_failure_total"} | counter | Deliveries rejected or unreachable. |
orchestrator_events_total{name="outbox_dead_letter_total"} | counter | Messages moved to dead-letter. |
orchestrator_operation_latency_seconds{operation="webhook_delivery"} | histogram | Per-subscriber delivery latency. |
orchestrator_events_total{name="webhook_signing_failure_total"} | counter | Deliveries not sent because they could not be signed (counted as failed attempts). |
Suggested alerts:
orchestrator_queue_depth{queue="outbox"}above a few hundred for more than five minutes — the backlog is not clearing.- Any increase in
orchestrator_queue_depth{queue="dead_letter"}— a subscriber has been failing long enough to give up on.
Both are charted on the starter Grafana board at
deploy/grafana/orchestrator-dashboard.json,
scraped via deploy/kubernetes/servicemonitor.yaml.
Counter families are registered without a _total suffix and the Prometheus
encoder appends it, so the names above are exactly what /metrics exposes.
Delivery contract
Each delivery is a POST with a JSON body of { id, topic, payload, correlation_id }
and these headers:
X-Webhook-Id— the outbox message id, stable across retries. Use it to deduplicate on your side.X-Webhook-Topic— the event topic.X-Webhook-Signature— hex HMAC-SHA256 of the raw body using the secret you supplied at registration. Verify it before trusting the payload.Content-Digest,Signature-Input,Signature— when the deployment has UCP signing keys (UCP_SIGNING_KEY), every delivery also carries an RFC 9421 message signature (labelsig1) by the active key. It covers@method,@authority,@path,@query(when the URL has one),content-digestandcontent-type. Verify it with the JWK named bykeyidin the top-levelkeys[]of/.well-known/ucp, as UCP requires for business-to-platform webhooks. Unlike the HMAC, this needs no shared secret. A delivery that cannot be signed is not sent unsigned; it fails and is retried.
Any 2xx is treated as accepted. Anything else, including a connection failure, counts as a failed attempt.
Operational steps
- Watch the depth gauges. A rising outbox means downstream unavailability or
too small a batch size; a rising dead-letter count means a subscriber has been
failing past
max_attempts. - Inspect dead-letter with
facade.list_dead_letter().await; each entry carriesid,topic,correlation_id, andattempts. - Fix the cause first, then replay with
facade.replay_from_dead_letter(&message_id).await, which returns the message to the outbox withattemptsreset to zero. - Registrations are durable. They live in the
webhookstable under Postgres and inwebhooks.jsonunder file-backed persistence, so they survive restarts.
Failure behaviour
- Deliverer returns
Ok— the message is consumed and removed from the outbox. - Deliverer returns
Err—attemptsis incremented; the message is re-enqueued, or moved to dead-letter onceattemptsexceedsmax_attempts. - No matching registration — delivery succeeds trivially and the message is consumed. An event with no subscriber is not an error.
- Idempotency — checkout and payment lifecycle calls use idempotency keys, so a duplicate request with the same key returns the original result without re-running side effects.
Runbook: Dead-letter queue handling
When messages reach dead-letter
Messages are moved to the dead-letter queue when they exceed the configured max_attempts in process_outbox_once(max_attempts).
Diagnostics
- List entries:
facade.list_dead_letter().awaitreturns all dead-letter messages withid,topic,payload,correlation_id, andattempts. - Use
correlation_idto correlate with checkout/transaction logs and trace the original request.
Replay
- Identify the message
idfromlist_dead_letter(). - Fix the root cause (e.g. downstream API availability, schema change, or configuration).
- Replay:
facade.replay_from_dead_letter(&message_id).await. Returnstrueif the message was found and re-enqueued. - The message is re-enqueued with
attemptsreset to 0 and will be processed again by the nextprocess_outbox_oncerun.
Do not
- Replay in a tight loop without fixing the cause; messages will fail again and return to dead-letter.
- Delete or clear dead-letter without logging or archiving if you need an audit trail.
Runbook: Payment reconciliation
Overview
Reconciliation compares the orchestrator’s durable view of payment state (per transaction) with the payment provider’s view (when the provider implements get_payment_state). In v0.2.0, the persistent facade keeps payment state across restart for checkout outcomes and lifecycle transitions. Use reconciliation to detect drift (e.g. captured in our store but voided at the provider).
Running reconciliation
- Collect transaction IDs to reconcile (e.g. from your orders or time window).
- Call
facade.run_reconciliation(&transaction_ids).await. - Inspect
report.mismatches: each entry hastransaction_id,our_state, andprovider_state(if the provider returned a state). - If you need to inspect one transaction directly, read the stored state through the facade before or after a restart and compare it with provider telemetry.
Handling mismatches
- Our state differs from provider: Investigate whether the provider was updated outside the orchestrator (e.g. manual void/refund) or a previous call failed after we updated our state. Align data or correct the provider state as per your policy.
- Provider does not support get_payment_state: Default implementation returns
None; reconciliation then never reports a mismatch for that provider. Implementget_payment_stateon your payment provider adapter to enable drift detection.
Scheduling
Run reconciliation periodically (e.g. daily) over recent transaction IDs and alert on non-empty mismatches.
Release checklist
Before cutting a release (e.g. GitHub tag and release notes), complete the following.
Pre-release
- All pipelines pass before push/release:
- CI (
.github/workflows/ci.yml): format, clippy, tests, Postgres backend, release-gate. - Audit (
.github/workflows/audit.yml):cargo audit(dependency vulnerabilities).
- CI (
- For first version / branch protection: require both CI and Audit as status checks so no push or merge succeeds until both pass.
-
CHANGELOG.mdis updated for the release version and date. - Version in root
Cargo.toml(workspace.package) and any crate-specific overrides is set to the release version, and every pinned reference follows it: the README badge, the image tag indeploy/kubernetes/,README.md,deploy/README.mdanddocs/plug-and-deploy.md, the Helm chart’sappVersion, andversionplus the image tag inserver.json.deploy_manifests_testfails on any that lag. - Runbooks are up to date:
docs/runbooks/retries-and-outbox.md,dead-letter-handling.md,reconciliation.md. - Production docs and config examples include
PUBLIC_BASE_URLso discovery never advertises localhost in a release deployment. - Kubernetes manifests and deployment docs agree on the supported replica/storage topology for file-backed persistence.
Acceptance
-
cargo test --workspacepasses locally. -
Postgres backend tests pass against a live database — they skip silently without
DATABASE_URL, so running them is not optional before a release:docker compose up -d postgres DATABASE_URL=postgres://orchestrator:secret@localhost:5432/orchestrator \ cargo test -p orchestrator-runtime --test postgres_backend_test DATABASE_URL=postgres://orchestrator:secret@localhost:5432/orchestrator \ cargo run -p orchestrator-http --bin orchestrator-server -- --migrate -
Security and authz tests pass (
authorize_checkout, tenant mismatch, missing scope, cross-tenant idempotency; API integration tests for 401 when auth required and missing/invalid token). -
Conformance tests pass:
cargo test -p orchestrator-http --test discovery_testandcargo test -p orchestrator-api --test authz_and_adapters(discovery, A2A, AP2 strict). -
Persistent restart-recovery test passes (
persistent_runner_restart_returns_same_idempotent_result). -
Payment lifecycle persistence test passes (
payment_lifecycle_state_survives_restart). -
Payment reconciliation and lifecycle tests pass.
-
Outbox/dead-letter and duplicate-delivery tests pass.
Release
- Push the release commit and wait until CI and Audit pass on that exact commit. Only then tag it.
- Create and push an annotated tag (e.g.
v0.13.0):git tag -a v0.13.0 -m "v0.13.0"thengit push origin v0.13.0. - Nothing else to do for the GitHub release: pushing the tag runs the Release workflow (
.github/workflows/release.yml), which publishes the release with that version’sCHANGELOG.mdsection copied verbatim as its notes. It fails, and publishes nothing, ifCHANGELOG.mdhas no## [x.y.z]section for the tag. The notes come fromCHANGELOG.mdas it is at the tagged commit, so get the section right before tagging, and use absolute links, because relative ones break on the release page. - The same tag push runs the Container image workflow (
.github/workflows/image.yml): it buildslinux/amd64andlinux/arm64on native runners and publishesghcr.io/ancientice/commerce-orchestrator-api:<version>and:latestwith an SBOM and build provenance. It fails, and publishes nothing, if the tag does not match theCargo.tomlversion. Check the run is green anddocker pull ghcr.io/ancientice/commerce-orchestrator-api:<version>works. To publish an image for an older tag, run the workflow by hand with that tag. - First image only: the GHCR package starts private. Make it public in the package settings and link it to this repository so anyone can pull it.
- No crates are published to crates.io; Rust consumers pin the tag (see consumer integration).
Post-release
- Bump version to next development (e.g. 0.1.1 or 0.2.0) in
Cargo.tomland add an[Unreleased]section inCHANGELOG.mdif using Keep a Changelog.
Optional (supply chain)
- Generate SBOM (e.g.
cargo cyclonedxorcargo sbom) and attach to release. - Run a container image vulnerability scan before promoting to production (e.g. scan
ghcr.io/ancientice/commerce-orchestrator-api:<version>with Trivy or your registry’s scanner).