# Universal Commerce Protocol checkout

A platform can buy from a customer through the Universal Commerce Protocol (UCP). The customer publishes a business profile, lists the platforms it accepts, and the platform then creates, reads, replaces, completes and cancels checkouts at the customer's own endpoint, and is sent the order.

Status: preview, off by default, built from the specification and the card processor's documentation, not run against a live platform. It is on only with `SKERRY_UCP_ENABLED=true` for the deployment. Off, the API's own operations answer 409 `capability_off` and the protocol's answer 503 `{ "code": "capability_off" }`. Completing a checkout charges a delegated payment token, so it also needs what [agentic checkout](agentic-checkout.md) needs: `SKERRY_AGENT_TOKENS_ENABLED=true` and a merchant account that reports the feature.

This is not a second checkout. It is a second set of shapes over the engine that serves the Agentic Commerce Protocol: the same checkout sessions (`source: "agentic"`), the same pricing callback, the same charge, ledger entries, receipt, events and books delivery, and the same refunds. A session answers only to the protocol that opened it, and here only to the platform that opened it. Skerry holds no catalogue and computes no tax: what a buyer is shown comes from the customer's system, as described in [agentic-checkout.md](agentic-checkout.md#what-the-customer-sets).

## Protocol version

The code follows version `2026-08-25` of the specification, read on 2026-11-14 from its repository (`github.com/Universal-Commerce-Protocol/ucp`, branch `release/2026-08-25` at `cfba1e7`, 2 November 2026: `docs/specification` and `source/schemas`), and version `2026-06-25` of the card processor's `com.stripe.payments` handler ([its page](https://docs.stripe.com/agentic-commerce/protocols/ucp/stripe-payments-handler), read the same day).

One version is spoken. A platform's protocol version is the `ucp.version` of its profile; one that is not `2026-08-25` is refused 422 `version_unsupported`. A platform whose profile does not declare `dev.ucp.shopping.checkout` at `2026-08-25` is answered 200 with `ucp.status: "error"` and the message `capabilities_incompatible`. The order capability and the AP2 extension are in force for a platform only when its profile declares them at the same version.

**No older version is published.** The specification lets a business link older versions from its profile through `supported_versions`, each to a complete profile of its own. None is offered here: `2026-04-08` differs in forms this code does not produce (the AP2 extension is named `dev.ucp.shopping.ap2_mandate` there, a card's brands are given as `constraints.brands`, and schemas sit at other addresses), and it has not been built.

Until 14 November 2026 this page and the code named the version `2026-01-23`. That was never what was spoken. Version `2026-01-23` signs with a detached JWT in a `Request-Signature` header, publishes `signing_keys`, carries `event_id` and `created_time` in the webhook body and has no `GET /orders/{id}`. This code has always used RFC 9421 signatures, `keys`, `Webhook-Id` and `Webhook-Timestamp` headers, `GET /orders/{id}`, signed totals and the `unrecoverable` severity (forms that came with `2026-04-08`), and `dev.ucp.common.payment.ap2_mandate` and the `constraints.properties` form of a card's brands (forms of `2026-08-25`). A platform on the real `2026-01-23` could not have worked against it, so nothing of that version is kept.

## What a business must do

1. Register a pricing callback (`POST /customers/{id}/agentic/pricing-callback`), unless it sells only fixed-amount payment links. It is the one agentic checkout uses.
2. Save its settings with `PUT /customers/{id}/ucp/settings`, at least `trusted_profiles`: the profile address of each platform it accepts.
3. Serve or redirect its own `https://<its domain>/.well-known/ucp` to the `profile_url` the settings return (`/ucp/{customer_id}/.well-known/ucp` at this API). A platform discovers a business at the business's own domain; Skerry cannot publish there.
4. Confirm the commerce relationship with each platform at the card processor, in the same environment. The processor's handler requires it before a platform can make a token for the business; the business starts it and the platform approves it in its dashboard. No API for this was stated, so Skerry does not do it.
5. Send the buyer a confirmation email when a checkout completes. The protocol makes this the business's duty and Skerry sends no email to buyers; the `checkout_session.completed` event says when.

| Operation | Scope | Idempotency-Key | Moves money | What it does |
|---|---|---|---|---|
| `GET /customers/{id}/ucp/settings` | `agentic:read` | none | no | What the customer has set for the Universal Commerce Protocol, with `profile_url` (where its business profile is served), `endpoint`, and `signing_key`: the public half of its signing key, never the private half. |
| `PUT /customers/{id}/ucp/settings` | `agentic:write` | none | no | Replace the customer's settings: the platforms it accepts, its profile id at the card processor, the card brands and links it publishes, which wording the handler's environment uses, whether the AP2 mandates extension is on, whether carts are offered, and (sandbox only) whether unsigned requests are taken. |

The settings are replaced whole: a member left out goes back to its default.

| Member | Default | Meaning |
|---|---|---|
| `trusted_profiles` | none | The platforms accepted, by the exact address of their profile. A platform not listed is refused 403 `profile_not_trusted`, before its profile is fetched. |
| `business_profile` | null | The customer's profile id at the card processor (`profile_...`). Null publishes the one its merchant account reports. |
| `card_brands` | all four | Which of `visa`, `mastercard`, `amex`, `discover` the handler offers. |
| `links` | none | `{ type, url }` with type `privacy_policy`, `terms_of_service`, `refund_policy`, `shipping_policy` or `faq`, shown on every checkout. Links the pricing callback returns are added where the protocol has a type for them. |
| `environment_words` | `handler` | The processor's handler page calls the environment `testmode` or `livemode`; its seller guide says `sandbox` or `production`. `handler` publishes the first pair, `seller_guide` the second. |
| `ap2_enabled` | false | Switches the AP2 mandates extension on. See its limit below. |
| `carts_enabled` | false | Offers the cart capability (`dev.ucp.shopping.cart`). Carts are priced by the pricing callback with `type: "cart.price"`: switch this on once the callback answers that. |
| `cart_continue_url` | null | Where a cart is handed to the customer's own pages: an absolute https URL, with `{cart_id}` where the cart's id goes. Each cart then carries it as `continue_url`, for sharing and for a person to pick the cart up. Without it, carts carry none: Skerry has no page of its own for a cart. |
| `allow_unsigned` | false | Sandbox only: take requests that carry no signature, for testing. A request that does carry one is still checked. Refused for a live customer. |

The first save makes the customer's signing key, an ECDSA P-256 pair. The public half is returned as `signing_key` and published in the profile. The private half is sealed with `SKERRY_BOOKS_SEAL_KEY`, as the signing and webhook secrets of agentic checkout are, and no operation returns it. A deployment with no sealing key refuses the save with 503 `platform_unavailable`.

## The business profile

`GET /ucp/{customer_id}/.well-known/ucp` is public and may be cached for a minute. It exists once the customer has saved its settings.

```json
{
  "ucp": {
    "version": "2026-08-25",
    "services": { "dev.ucp.shopping": [{ "version": "2026-08-25", "spec": "https://ucp.dev/2026-08-25/specification/overview/", "transport": "rest", "endpoint": "https://api.skerry.xyz/ucp/{customer_id}", "schema": "https://ucp.dev/2026-08-25/services/shopping/rest.openapi.json" }] },
    "capabilities": { "dev.ucp.shopping.checkout": [{ "version": "2026-08-25", "spec": "https://ucp.dev/2026-08-25/specification/shopping/checkout", "schema": "https://ucp.dev/2026-08-25/schemas/shopping/checkout.json" }], "dev.ucp.shopping.order": [{ "version": "2026-08-25", "spec": "https://ucp.dev/2026-08-25/specification/shopping/order", "schema": "https://ucp.dev/2026-08-25/schemas/shopping/order.json" }] },
    "payment_handlers": { "com.stripe.payments": [{ "id": "stripe_payments", "version": "2026-06-25", "available_instruments": [{ "type": "card", "constraints": { "properties": { "brand": { "enum": ["visa", "mastercard", "amex", "discover"] } } } }], "config": { "environment": "testmode", "business_profile": "profile_..." } }] }
  },
  "keys": [{ "kid": "...", "kty": "EC", "crv": "P-256", "x": "...", "y": "...", "use": "sig", "alg": "ES256" }]
}
```

`dev.ucp.common.payment.ap2_mandate` is listed only when the customer has switched it on. Each capability states its version and the addresses of its specification and schema, as the specification's profile examples give them; in a response only the version is stated. `payment_handlers` is empty when the customer cannot take a delegated payment token.

## The protocol's operations

| Operation | Scope | Idempotency-Key | Moves money | What it does |
|---|---|---|---|---|
| `GET /ucp/{customer_id}/.well-known/ucp` | `none` | none | no | The customer's business profile: version, the shopping service and its endpoint, capabilities, the card processor's payment handler, and the customer's public signing key. |
| `POST /ucp/{customer_id}/checkout-sessions` | `ucp_signature` | none | no | Create a checkout. |
| `GET /ucp/{customer_id}/checkout-sessions/{id}` | `ucp_signature` | none | no | Read a checkout. |
| `PUT /ucp/{customer_id}/checkout-sessions/{id}` | `ucp_signature` | none | no | Replace a checkout: the body is the whole of what the platform sets. |
| `POST /ucp/{customer_id}/checkout-sessions/{id}/complete` | `ucp_signature` | none | yes | Complete with the card processor's payment token, for the checkout's exact total. |
| `POST /ucp/{customer_id}/checkout-sessions/{id}/cancel` | `ucp_signature` | none | no | Cancel a checkout that is neither completed nor canceled. |
| `POST /ucp/{customer_id}/carts` | `ucp_signature` | none | no | Create a cart: the items priced as an estimate by the business's system. |
| `GET /ucp/{customer_id}/carts/{id}` | `ucp_signature` | none | no | Read a cart. |
| `PUT /ucp/{customer_id}/carts/{id}` | `ucp_signature` | none | no | Replace a cart's items, buyer and context; priced again. |
| `POST /ucp/{customer_id}/carts/{id}/cancel` | `ucp_signature` | none | no | Cancel a cart: answered with the cart as it was, and not found from then on. |
| `POST /ucp/{customer_id}/catalog/search` | `ucp_signature` | none | no | Search the customer's active products (capability dev.ucp.shopping.catalog.search): `query` matches title, description or sku; `filters.categories` matches any listed category. |
| `POST /ucp/{customer_id}/catalog/lookup` | `ucp_signature` | none | no | The products and variants a list of ids names (capability dev.ucp.shopping.catalog.lookup): product ids, variant ids or skus, up to 50. |
| `POST /ucp/{customer_id}/catalog/product` | `ucp_signature` | none | no | One product, by its id or a variant's (capability dev.ucp.shopping.catalog.lookup). |
| `GET /ucp/{customer_id}/orders/{id}` | `ucp_signature` | none | no | The order of a completed checkout, as its webhook carries it, for the platform that placed it. |

These are not the API's own operations and take no API key. Protocol errors are a status with `{ "code", "content" }`. When there is no resource to return (a checkout or an order that is not there, or no shared checkout capability) the answer is 200 with `{ "ucp": { "version", "status": "error" }, "messages": [{ "type": "error", "code", "content", "severity": "unrecoverable" }] }`, the specification's error response.

### Who is calling

The platform sends `UCP-Agent: profile="https://platform.example/..."`. The address must be https, must be in the customer's `trusted_profiles`, and is fetched from a public address only, with a short timeout and a size limit, and kept for a minute.

| Refusal | Status |
|---|---|
| `invalid_profile_url` | 400: no `UCP-Agent`, or its `profile` is not an https address |
| `profile_not_trusted` | 403: the customer has not listed that profile |
| `profile_unreachable` | 424: the profile could not be fetched |
| `profile_malformed` | 422: what was fetched is not a profile |
| `version_unsupported` | 422: the profile's `ucp.version` is not `2026-08-25` |

### Signatures

Every request must be signed per RFC 9421 with a key in the `keys` of the platform's profile (found by the signature's `keyid`). Every signature the request carries is tried, and the first that verifies authenticates it. The signature must cover `@method`, `@authority`, `@path`, `@query` when the address has a query, `ucp-agent`, `idempotency-key` when the header is sent, and `content-digest` (RFC 9530, SHA-256) and `content-type` when there is a body. It is ES256: ECDSA P-256 over SHA-256 with the signature as raw `r||s` (64 bytes), not DER. `created` in the future and `expires` in the past are refused when the signature carries them; the protocol as read requires neither, so neither is required.

| Refusal | Status |
|---|---|
| `signature_missing` | 401 |
| `signature_invalid` | 401: it does not verify, or does not cover what it must |
| `key_not_found` | 401: no key of the profile has that `keyid` (the profile is read once more first, in case its keys changed) |
| `digest_mismatch` | 400 |
| `algorithm_unsupported` | 400 |

In sandbox only, a customer that sets `allow_unsigned` takes requests with no signature. The payment then records `request_signature: "not_required_in_sandbox"`. Responses are not signed: the protocol recommends a signature on the answer to complete and leaves the others optional.

### Checkouts

A create needs `line_items`, each with `item.id` and an integer `quantity`, or a `cart_id` (below). `cart_id` from a platform carts are not agreed with is refused with 400 `cart_not_supported`, as the cart page requires. A `PUT` replaces the whole of what the platform sets (line items and buyer) and the checkout comes back priced again.

| Status | When |
|---|---|
| `incomplete` | The business's system says the checkout cannot be paid as it stands. `messages` say why. |
| `ready_for_complete` | It can be completed. |
| `complete_in_progress` | A complete is running. A `PUT` meanwhile returns the checkout unchanged with a recoverable error. |
| `completed` | Paid. `order` holds the order's `id` and `permalink_url`. |
| `canceled` | Canceled by the platform, or run out of time (24 hours after creation; `expires_at` says when). |

`requires_escalation` is never answered and `continue_url` is never sent. The protocol requires an https `continue_url` with that status, and there is no page a buyer can be handed to for these sessions. So where the business's system asks for something only the buyer can do (signing in, proving their age, an approval), the message is `unrecoverable`, and a checkout that is not ready for a reason the platform cannot change carries an `unrecoverable` `not_ready` message. The same holds when the buyer's bank asks the buyer to authenticate at complete: the attempt is withdrawn and answered as a recoverable decline, since another credential may succeed.

Fulfilment cannot be chosen through this binding: the fulfilment extension (`dev.ucp.shopping.fulfillment`) is not offered. A customer whose system requires a fulfilment option to be chosen gets `incomplete` with an `unrecoverable` `fulfillment_selection_unavailable` message. Items that need no choice work.

`totals` hold exactly one `subtotal` and one `total`; discounts are negative; every entry other than `total` sums to it. The `total` is the amount charged, as the business's system stated it. The `subtotal` is what remains of it once the other entries are taken out, so the list sums whatever the business's own subtotal included. An entry of a type the protocol does not name (a tip, gift wrap, store credit) keeps its type and carries `display_text`.

`messages` are `{ type, code, path, content, severity }`. A business outcome is always HTTP 200 with messages; a checkout that is over answers a change, a cancel or a complete with itself and a `checkout_closed` message.

### Idempotency

An `Idempotency-Key` on a POST or PUT is honoured: the same key with the same raw body (compared by its SHA-256, as the protocol says) returns the first answer (with `Idempotent-Replayed: true`); with a different body, 409 `idempotency_conflict`; while the first is still running, 409 `idempotency_in_flight`. Keys are kept without a time limit, which is longer than the 24 hours the protocol asks for. The protocol says operations that change state should support the key and says what a server must do when one is sent; its REST description marks the header as required on POST and PUT. Here a POST or PUT without one is still taken, except complete. Complete moves money, so there it is: without it, 400 `idempotency_key_required`. After a decline, complete again with a new key.

### Complete and the payment handler

The platform sends the selected instrument:

```json
{ "payment": { "instruments": [{ "id": "instr_1", "handler_id": "stripe_payments", "type": "card", "selected": true, "credential": { "type": "stripe_payment_token", "token": "spt_..." } }] } }
```

The token is charged on the customer's own merchant account for the checkout's exact total, through the same code as every other delegated payment token (`lib/agent-token.ts`), with the token sent to the processor exactly as it was presented. Any other handler, instrument type or credential type is HTTP 200 with a recoverable `payment_failed` message. A decline is a recoverable `payment_declined` message and the checkout is `ready_for_complete` again.

The payment says it came through this protocol: `agent.protocol` is `ucp`, `agent_identity` records the platform and the key that signed, and `GET /payments/{id}/authorisation` carries a `ucp.checkout.complete` entry with the platform's profile, whether the request's signature verified, and the buyer's address and user agent when the platform sent them as `signals`.

## Orders

When a checkout completes, and again each time a refund of its payment is made or changes state, the full order is POSTed to the `config.webhook_url` of the order capability in the platform's profile, as it stood when the checkout was opened. A platform that declares none is sent nothing. The body is the order itself, with no envelope.

| Header | Value |
|---|---|
| `Webhook-Id` | The delivery's id. The same on every retry. |
| `Webhook-Timestamp` | Unix seconds, fixed when the delivery was recorded. The same on every retry. |
| `Content-Digest` | SHA-256 of the raw body. |
| `UCP-Agent` | `profile="<the business profile's address>"` |
| `Signature-Input`, `Signature` | RFC 9421, ES256, covering `@method`, `@authority`, `@path`, `ucp-agent`, `content-digest`, `content-type`, `webhook-id`, `webhook-timestamp`; `keyid` is the `kid` in the business profile's `keys`. |

Deliveries go through the queue agentic checkout's order events use. The protocol says a failed delivery must be retried and does not say how often: here it is tried at once and then after a minute, five, twenty-five, two hours and ten hours. `GET /customers/{id}/agentic/orders/{session_id}` shows how the last one went.

`GET /ucp/{customer_id}/orders/{id}` returns the same order to the platform that placed it; to anyone else, and for an order that is not there, the answer is 200 with `ucp.status: "error"` and a `not_found` message, as the protocol's order page shows.

The order's `line_items` carry `quantity: { original, total, fulfilled }` and a derived `status`: `processing`, `fulfilled` once the business has marked the order completed, `removed` once it has canceled it (`POST /customers/{id}/agentic/orders/{session_id}`). `fulfillment.expectations` and `fulfillment.events` are always empty: no expectations or shipment events are kept for a session. `adjustments` holds one `refund` entry per refund, with the amount returned as a negative `total`: the protocol's adjustment totals are negative for money returned to the buyer.

## The AP2 mandates extension, and its limit

Off by default. It is in force for a checkout when the customer has `ap2_enabled` and the platform's profile declares `dev.ucp.common.payment.ap2_mandate`, decided when the checkout is opened.

What is done, the business's side only:

- Every checkout response carries `ap2.merchant_authorization`: a JWS with a detached payload, `<header>..<signature>`, header exactly `{ "alg": "ES256", "kid": "<the business's kid>" }`, signed over `base64url(header) + "." + base64url(JCS(checkout without its ap2 member))` (RFC 8785), with the signature as raw `r||s`.
- A complete without `ap2.checkout_mandate` is refused `mandate_required`.
- The mandate is read in AP2 v0.2's form (ap2-protocol.org, "Agentic Payment Protocol (v0.2)", read 2026-11-16): an SD-JWT whose `vct` names its type. Only a closed Checkout Mandate (`mandate.checkout.1`; the Checkout Mandate page's table writes it `mandate.checkout`, and that is read too) is taken. An open mandate (`mandate.checkout.open.1`, `mandate.payment.open.1`) is a standing instruction to an agent, not consent to this checkout: `mandate_not_closed`. Any other type, a Payment Mandate included, is `mandate_unsupported`: a Payment Mandate goes to the payment handler, not to the business. Its `checkout_jwt` is the business's merchant authorization with the checkout attached (the same header and signature, the canonical checkout as the payload), and `checkout_hash` the base64url SHA-256 of it.
- Of the mandate, these are checked: its `exp` has not passed (`mandate_expired`); it carries the business's signed checkout (`merchant_authorization_missing`); that is this business's own signature over exactly that checkout, and `checkout_hash` is its hash (`merchant_authorization_invalid`); the checkout is this checkout, at its present total and currency (`mandate_scope_mismatch`).
- **Older form, kept:** the mandate of January, with no `vct`, that embeds a checkout carrying `ap2.merchant_authorization` somewhere in its claims. It is checked the same way.
- The payment credential goes to the processor unchanged.
- The answer to complete carries `ap2.checkout_receipt`: an AP2 v0.2 Checkout Receipt, a JWT signed with the business's key (ES256, its `kid`), with `status` `Success` and the `order_id`, or `Error` with `error: "payment_failed"` when the payment was declined; `iss` is the business's profile address, `iat` the time, and `reference` the base64url SHA-256 of the mandate as presented. The extension's `ap2` object names no receipt field: `checkout_receipt` is this platform's addition. A refused mandate is answered with the refusal, without a receipt. Payment Receipts belong to the payment processor and are not issued here.

The limit: **the mandate's own signature and key binding are not verified.** How the key of the mandate's issuer is found and trusted is left by the extension to the AP2 specification, which is not implemented here. So this binding proves that the buyer's side presented terms this business signed, and does not prove who presented them. The payment's authorisation evidence says so: its `ucp.checkout.complete` entry holds `ap2: { checkout_mandate_sha256, merchant_authorization_verified: true, session_and_total_matched: true, mandate_signature_verified: false, key_binding_verified: false }`. Do not switch the extension on where the mandate's signature is what you rely on.

The AP2 v0.2 pages state no more than this about the issuer's key: a closed mandate is validated "as coming from a User directly, using a User Credential or a trust list of Agent Providers". Neither a credential format to resolve nor a trust list exists to read, so verifying the mandate's signature is not established; it needs such a list (the specification's work continues in the FIDO Alliance). The evidence also records the mandate's `form` (`ap2-v0.2` or `embedded`).

Two more things the extension does not state, and are choices made here: the HTTP status of these refusals (each is 400), and which claim of the mandate carries the checkout (it is looked for in the mandate's payload and in each disclosure).

### Carts

Offered when the customer has `carts_enabled` and the platform's profile declares `dev.ucp.shopping.cart` at 2026-08-25; otherwise each cart operation is 400 `cart_not_supported`. Followed from the cart page and its REST binding (specification/shopping/cart, read 2026-11-16).

- `POST /carts` (201), `GET /carts/{id}`, `PUT /carts/{id}` (a full replacement) and `POST /carts/{id}/cancel`, under `/ucp/{customer_id}`, signed and checked as checkouts are, with the same `Idempotency-Key` handling.
- A cart is priced by the business's pricing callback, as a session is, with `type: "cart.price"` and `cart_id` in place of `checkout_session_id` (see [agentic-checkout.md](agentic-checkout.md)), or from its fixed-amount payment links. Its totals are estimates and it says so in an `info` message; the checkout made from it is priced again.
- A cart has no status: it is there, or it is not. It lasts 72 hours. One that is not there, has expired or was canceled is answered 200 with `ucp.status: "error"` and the message `not_found`. Cancel answers with the cart as it was. A cart answers only to the platform that made it.
- `cart_id` on a checkout create makes the checkout from the cart's items, buyer and currency; the request's own items are not read. While a checkout made from the cart is open, the same create returns it (200) instead of making another.
- After conversion, as the cart page asks:
  - The cart and its checkout stay linked while the checkout is open. A change to the checkout's items (a quantity, an item removed) is carried back to the cart and priced again as an estimate. If that pricing fails, the cart is left as it was and the checkout still changes.
  - When the checkout completes, the cart is cleared, and every operation on it answers `not_found` from then on. This also holds when the checkout completes later through the processor's event. A checkout that is canceled leaves its cart as it was.
  - A cart carries `continue_url` when the customer has set `cart_continue_url`.

## Catalog

When the platform sets `SKERRY_CATALOG=on`, the profile also lists `dev.ucp.shopping.catalog.search` and `dev.ucp.shopping.catalog.lookup`, and the customer's products can be searched and looked up at `/catalog/search`, `/catalog/lookup` and `/catalog/product` under the same address, with the same profile, signature and trust checks as checkout. A platform must declare the operation's capability at 2026-08-25, or the answer is a 200 error response with `capabilities_incompatible`. No `Idempotency-Key` is taken: these change nothing. See [catalog.md](catalog.md).

## What is not offered

- Apple Pay and Google Pay: only the card processor's handler with a card and a payment token.
- The MCP and A2A transports of this protocol: REST only. (A business that sells has an A2A card of its own over agentic checkout: see [a2a.md](a2a.md).)
- Identity linking.
- Choosing fulfilment, `continue_url` and `requires_escalation`, and signed responses, as described above.
- Refunds asked for by the platform. The business refunds through `POST /payments/{id}/refunds`, and the platform is sent the order again.
