# Agent checkout

> Buy prepaid bars from an AI agent through the Universal Commerce Protocol (UCP) or the Agentic Commerce Protocol (ACP), paid by a Stripe shared payment token.

Source: https://getmarkethistory.com/docs/agent-checkout

An AI agent can buy a pack of bars for its user through a checkout session, with no sign-in. Two
open protocols reach the same checkout:

|                 | [UCP](https://ucp.dev)                                                                            | [ACP](https://agenticcommerce.dev)                                                 |
| --------------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| Discovery       | [`/.well-known/ucp`](https://getmarkethistory.com/.well-known/ucp) (version `2026-08-25`)                                     | [`/.well-known/acp.json`](https://getmarkethistory.com/.well-known/acp.json) (API version `2026-04-17`)        |
| Endpoint        | `/ucp/v1/checkout-sessions` (REST)                                                                | `/acp/checkout_sessions` (REST)                                                    |
| Payment handler | `com.stripe.payments`, id `stripe_payments`, instrument `card`, credential `stripe_payment_token` | `dev.acp.tokenized.card`, id `card_tokenized`, psp `stripe`, credential type `spt` |
| Update          | `PUT /checkout-sessions/{id}`                                                                     | `POST /checkout_sessions/{id}`                                                     |

Both have `GET` for a session, `…/complete` and `…/cancel`. Every `POST` (and UCP's `PUT`) needs an
`Idempotency-Key`. UCP requests also name the platform's profile in
`UCP-Agent: profile="https://…"`, which is fetched and must offer `dev.ucp.shopping.checkout` at
`2026-08-25`. ACP requests send `API-Version: 2026-04-17`.

## What you buy

One line item, **bars**, at the [one-off rate](https://getmarkethistory.com/docs/limits#buying-bars): $5 per million bars,
less per bar past 1,000,000, prices including GST. At least 1,000,000 bars ($5), at most
10,000,000,000, in blocks of 100. A quantity outside that is moved to the nearest valid one, and
the session says so in its messages before you pay.

- **UCP**: `{"item": {"id": "bars"}, "quantity": 2500000}`. The quantity is in bars (the item's
  `quantity_unit` is millions of bars at scale 6; `price` is the 500-cent rate per million).
- **ACP**: `{"id": "bars:2500000"}`, the size in the item id (`"bars"` alone is 1,000,000).

The totals show the list rate, the volume saving past 1,000,000 bars, and the total charged:
2,500,000 bars are $12.50 at list, $3.00 less, $9.50 to pay. Nothing is shipped: there is no
fulfillment step.

## Who gets the bars

- **With an API key** (`X-API-Key`, or `Authorization: Bearer mh_live_…`) on the request that
  creates the session: the bars go to that key's account. Only that key can see or pay the
  session.
- **Without one**: completing the session opens an account with no sign-in and no free monthly
  allowance, and returns its API key **once**: UCP in `order.api_key`, ACP in `metadata.api_key`,
  both in the `X-Api-Key` header. Store it. A retry of the same completion request (same
  `Idempotency-Key`, same body, within 48 hours) returns it again; a `GET` never does. An
  agent platform's own bearer token (ACP) is not an account here, so it opens a new account too.

Send the key as `Authorization: Bearer <key>` to the [API](https://getmarkethistory.com/docs/quickstart) from then on.

## Paying

Create a Stripe shared payment token for the session's total, in USD, for our Stripe profile (the
handler's `business_profile` on UCP, `merchant_id` on ACP), then complete the session with it.
The token is checked with Stripe first, then the session is claimed for that one payment, so a
replayed or concurrent completion never charges twice. A declined, spent, expired or too small
token leaves the session payable (UCP: `payment_failed` in `messages`; ACP: `402`,
`payment_declined`): get a new token and complete again. If Stripe cannot confirm the outcome,
the session stays `complete_in_progress`: do not pay again, write to
support@getmarkethistory.com with the session id.

Sessions expire 24 hours after they are made. Unspent bars are refundable within 14 days, as for
[bought bars](https://getmarkethistory.com/docs/limits#buying-bars) ([Terms §3](https://getmarkethistory.com/docs/terms#3-billing-bars-and-refunds)).

## Not offered

UCP: no cart, catalog, discount, fulfillment, order or identity-linking capabilities, no MCP or
A2A transport. ACP: only the `checkout` service (no order webhooks, `delegate_payment` or carts),
no 3-D Secure step. Signatures on requests are not required or checked. When the UCP profile
publishes a key in `keys`, every UCP response is signed with it (RFC 9421, ES256, covering
`@status`, `content-digest` and `content-type`).
