Platform agents: shopping at a merchant they do not belong to
How a shopping agent that belongs to a platform (Google, OpenAI, Microsoft, or a terminal on your desk) discovers a merchant on a payment processor, stages a checkout over UCP or ACP, and ends it with a payment page or a credential the processor can charge.
Anthropic's Claude Commerce Agents blueprint ships two agents a business runs for itself: the store's assistant, which talks to shoppers inside the store, and a merchant-operations assistant for the back office. A platform agent is the other program. It belongs to someone else, finds the store from outside, and shops through an endpoint the store publishes. This reference implementation gives every demo merchant that endpoint, so the stores that run the blueprint's assistant can also be shopped by an agent that has never seen their storefront.
The five demo merchants are fictional: Northstar Outfitters (Clover), Lumen Home (Stripe), Aurora Escapes (Adyen), Beacon Wireless (Worldpay), and Encore Seats (CyberSource). The examples below use Lumen Home on port 8016; the others answer the same calls on ports 8010, 8017, 8018, and 8019. Shopify's example, which serves a real Shopify store, is covered in 06-shopify.md; the processors are in 05-payment-processors.md.
Two protocols, one backend
A platform agent reaches a merchant through one of two published protocols. UCP (Universal Commerce Protocol) is the one Google's surfaces and Shopify's stores use; it runs over MCP (Model Context Protocol), so any MCP client can shop. ACP (Agentic Commerce Protocol) is the REST protocol OpenAI and Stripe published for ChatGPT, later adopted by Microsoft's Copilot Checkout.
Both are served by psp_commerce/thirdparty/ from the same StorefrontBackend and the same payment gateway the store's assistant uses, so a checkout staged by a platform agent is the same processor session the assistant's checkout card would open. verticals/_host.py installs both protocols on each merchant's API.
UCP: what the merchant serves
Discovery at /.well-known/ucp
A platform reads this document first. UcpService.profile() in psp_commerce/thirdparty/ucp.py builds it: ucp.version is 2026-04-08, the version Shopify's example and its recorded responses speak, with 2026-08-25, the current release, listed under supported_versions; ucp.services declares dev.ucp.shopping with transport: mcp at /api/ucp/mcp; ucp.capabilities lists checkout, cart, order, catalog search, and catalog lookup with their schema URLs on ucp.dev; ucp.payment_handlers names the credentials the merchant's processor can charge from a platform; and store carries the name, the processor, the policies endpoint /api/mcp, and a plain statement that continue_url is always returned.
curl -s http://localhost:8016/.well-known/ucp | python3 -m json.tool
The shopping service over MCP at /api/ucp/mcp
The endpoint is JSON-RPC over HTTP in the MCP shape. It answers initialize (protocol versions 2024-11-05, 2025-03-26, and 2025-06-18), ping, tools/list with real input schemas from psp_commerce/thirdparty/ucp_tools.py, tools/call, and MCP notifications (a 202 with no body). Twelve tools are listed.
| Tool | What it does |
|---|---|
search_catalog |
text search with an optional price filter (minor units) and page size |
get_product |
one product in full, with variants, availability, and media |
lookup_catalog |
several products by id |
create_cart, get_cart, update_cart |
a cart of variant lines; update_cart replaces the whole set, and a quantity of 0 removes a line |
create_checkout |
stages the lines with the processor and returns continue_url and payment.handlers |
update_checkout, get_checkout, cancel_checkout |
change, read, or cancel a checkout; get_checkout reports completed with an order block once the processor does |
complete_checkout |
pay with a credential the platform holds; only the listed handlers are accepted |
get_order |
read an order placed through this endpoint |
Every id is a gid:// string in Shopify's shape (gid://lumen-home/Product/<id>, gid://lumen-home/ProductVariant/<id>, gid://lumen-home/Cart/<token>, gid://lumen-home/Checkout/<id>, gid://lumen-home/Order/<id>), and every amount is in minor units. A failed call comes back as a result with isError: true and a messages list whose entries carry a code such as product_not_found or payment_handler_unsupported, a content string, and a severity. The older Storefront MCP endpoint at /api/mcp serves one tool, search_shop_policies_and_faqs, answered from the merchant's own policy text, because Shopify's example still reads policies there.
The agent profile
Every tools/call to a Shopify store must carry meta.ucp-agent.profile, a URL to an agent profile that says which capabilities the agent negotiates. Shopify publishes one for the 2026-04-08 capability set at https://shopify.dev/ucp/agent-profiles/2026-04-08/valid-with-capabilities.json. The reference's merchants accept calls with or without the key (UcpService.call drops meta before dispatch), and scripts/platform_agent.py sends Shopify's profile on every call so the same script shops at both kinds of store.
The return leg
create_checkout asks the processor for a session with return_url set to /ucp/return on the merchant API. After the shopper pays on the processor's page, the processor sends the browser there; the page says the agent that created the checkout will read the result, and nothing else happens in that tab. The platform learns the outcome from get_checkout, which makes the adapter read the session from the processor, record the order, and answer status: completed with the order id.
ACP: the other protocol
psp_commerce/thirdparty/acp.py serves the checkout-session API that OpenAI and Stripe specified (specification version 2026-04-17).
| Route | What it does |
|---|---|
POST /acp/checkout_sessions |
prices the items, stages a hosted checkout so a link-out always exists, and answers ready_for_payment with checkout_url, capabilities.payment.handlers, and totals |
POST /acp/checkout_sessions/{id} |
updates items or buyer |
GET /acp/checkout_sessions/{id} |
reads the session; it becomes completed with an order once the processor reports the hosted session paid |
POST /acp/checkout_sessions/{id}/complete |
charges payment_data (a token and the provider that minted it) through the gateway |
POST /acp/checkout_sessions/{id}/cancel |
cancels |
GET /acp/feed.json |
the product feed a platform indexes, up to 500 items |
capabilities.payment.handlers carries dev.acp.tokenized.card entries naming the processor and the credential type it charges: spt for Stripe's shared payment token, delegate_token elsewhere. A processor that cannot charge the credential answers 422 payment_handler_unsupported with checkout_url inside the error so the platform can link out; a declined charge answers 402 card_declined.
curl -s -X POST http://localhost:8016/acp/checkout_sessions -H 'Content-Type: application/json' -d '{"items":[{"id":"AR-2107","quantity":1}],"buyer":{"email":"shopper@example.com"}}'
OpenAI retired Instant Checkout in ChatGPT in March 2026 (CNBC, 24 March 2026), so no consumer ChatGPT path calls /acp/checkout_sessions today. OpenAI's developer documentation still publishes Agentic Checkout and Delegated Payment, and Copilot Checkout launched on ACP in January 2026, so the endpoint stays for platforms that speak it.
Eight ways a platform can end a checkout at a merchant on a processor
Shopify's reference is itself two flows. Its example hands the shopper to Shopify's checkout page through continue_url (the escalation path), while Shopify's stores also complete checkout inside Google, Copilot, and Meta with dev.shopify.shop_pay, dev.shopify.card, and com.google.pay handlers (the direct-checkout path). A merchant on a processor lands in one of eight variants, depending on who serves its endpoint and whether the platform renders payment through a payment handler or hands the shopper a URL. The rule that holds everywhere is UCP's own: a business must return continue_url when a checkout needs escalation, and the shopper finalizes the checkout through a trusted interface unless the AP2 mandates extension is supported (UCP checkout, 2026-04-08; unchanged in 2026-08-25).
docs/THIRD-PARTY-AGENTS.md. Counts are from the UCP handler census of 31 August 2026.| # | Variant | Who authorizes, with what | Processors (September 2026) | In this reference |
|---|---|---|---|---|
| 1 | Merchant-hosted endpoint, continue_url to the merchant's page |
the merchant's processor, on its hosted page or payment link, with an ordinary card or wallet | any processor | create_checkout returns the processor's page as continue_url |
| 2 | Merchant-hosted endpoint, Google Pay handler in gateway mode | the processor decrypts the Google Pay payload and authorizes | Adyen, CyberSource, Stripe, Worldpay, and the other Google Pay gateways | com.google.pay declared in PAYMENT_GATEWAY mode; complete_checkout calls authorize_delegated(provider="google_pay") |
| 3 | Processor-native UCP handler (the processor tokenizes) | the processor, with a shared payment token | Stripe's com.stripe.payments, private preview |
declared on the Stripe merchant |
| 4 | Processor-hosted endpoint (the processor speaks UCP or ACP for the merchant) | the processor, with its own token | Stripe's Agentic Commerce Suite, Adyen Agentic, PayPal Agent Ready, Visa Intelligent Commerce Connect | not implemented; it is the processor's own product |
| 5 | ACP delegated-token completion | the merchant's processor consumes a delegated token (Stripe shared payment token, Worldpay delegate token, PayPal or Braintree delegated token, Checkout.com delegated tokenization) | Stripe, Worldpay, PayPal, Checkout.com | /acp/checkout_sessions/{id}/complete |
| 6 | Link-out or app (ChatGPT after Instant Checkout, Google's Universal Cart, Amazon Buy for Me) | the merchant's processor, on the merchant's own web checkout | any processor | the hosted checkout page and the store's own pages |
| 7 | Pay-by-link handoff through the processor's MCP tools, with no commerce protocol | the processor, with a card on the hosted page or a shared payment token through an HTTP 402 challenge at Stripe | Stripe, Adyen, Visa Acceptance, Worldpay create links over MCP | CHECKOUT_MODEL=link |
| 8 | AP2 mandates, human not present | the processor verifies an SD-JWT payment mandate | no processor in production | not implemented |
Sources, all read on 6 September 2026: Google's Google Pay payment handler page, Stripe's payments handler and MCP monetization pages, OpenAI's checkout specification, and Worldpay's Pay via AI Agent page.
Only variant 1 matches Shopify's escalation path structurally. Variant 2 is Shopify's direct-checkout path with the merchant hosting the endpoint and the merchant's processor authorizing in place of Shopify Payments. In variants 3, 4, and 5 the processor authorizes without the shopper visiting any merchant page.
What each processor charges, and what the simulated gateway refuses
Each adapter declares delegated_providers, and authorize_delegated maps the credential to the processor's own request. Stripe charges a Google Pay gateway token and a shared payment token (both need enrolment); Adyen a Google Pay token, once Google Pay is enabled on the account; Worldpay a Google Pay token and a delegate token; CyberSource a Google Pay payload and a Visa Intelligent Commerce credential taken as a transient token; Clover none. The exact calls are listed per processor in 05-payment-processors.md.
Without credentials every merchant runs on the simulated gateway in psp_commerce/adapters/mock.py. It accepts demo tokens by documented prefix (gpay_, spt_, dlg_, vic_) and records who paid and with what, and it asks the real adapter it stands in for which providers that adapter could charge, refusing the rest with payment_handler_unsupported and naming continue_url as the path to take. So a dlg_ token at Lumen Home is refused even in simulation, and any credential at Northstar Outfitters (tests/test_thirdparty.py::test_ucp_refuses_a_credential_the_processor_cannot_charge).
Running a platform agent four ways
Start the merchant first. The platform folder's script keeps the API up with nothing else running; with STRIPE_SECRET_KEY in platforms/stripe/.env the merchant boots live against Stripe's test environment and continue_url is a Stripe page, and without it the gateway is simulated and continue_url is a local page.
./platforms/stripe/third-party/run.sh --serve
1. The scripted agent
scripts/platform_agent.py is a small UCP client with a fixed plan: read discovery, search for the goal, pick the first in-stock product, create a cart, create a checkout, and print what a platform can do with the result. The platform folder's run.sh wraps this command:
python scripts/platform_agent.py --merchant http://localhost:8016 --goal "a table lamp under 80 dollars"
What it prints, with ids shortened:
discovery: Lumen Home on Stripe · UCP 2026-04-08, 2026-08-25 · handlers ['com.google.pay', 'com.stripe.payments']
picked: … · USD 22.00 · variant gid://lumen-home/ProductVariant/…
cart: gid://lumen-home/Cart/… · total USD 22.00
checkout: gid://lumen-home/Checkout/cs_test_… · status incomplete · total 22.00
continue_url (variant 1, the shopper pays on the processor's page): https://checkout.stripe.com/c/pay/cs_test_…
payment handlers the merchant accepts (variant 2/3): ['com.google.pay', 'com.stripe.payments']
--complete TOKEN presents a credential through complete_checkout under the com.google.pay handler: on the simulated gateway --complete gpay_demo ends with platform-completed: status completed · order …, and on live Stripe the same flag makes Stripe refuse the demo token, as it should.
2. A model driving the tools
With --model, the script hands the merchant's tools to a model through the reference's provider contract in psp_commerce/runtime/ (see 07-any-model.md) and prints every call the model makes. --model alone picks the provider's default (claude-sonnet-5, gpt-5, gemini-2.5-pro); --model gpt-5-mini names one; --provider openai or --provider gemini picks the vendor, with OPENAI_API_KEY or GOOGLE_API_KEY in place of ANTHROPIC_API_KEY and pip install openai google-genai once.
python scripts/platform_agent.py --merchant http://localhost:8016 --goal "a reading lamp for a bedside table, under 60 dollars" --model
--base-url points the OpenAI provider at any endpoint that speaks the chat-completions shape, which is how a local model runs the same test:
python scripts/platform_agent.py --merchant http://localhost:8016 --goal "a table lamp under 80 dollars" --model llama3.3 --provider openai --base-url http://localhost:11434/v1
The loop runs end to end on a scripted provider (tests/test_demo_paths.py::test_platform_agent_runs_on_any_provider), and Claude ran it live against Lumen Home on Stripe on 6 September 2026: three searches, one product read, the cart, the checkout, and a report of the Stripe continue_url and the handlers without claiming to have paid. The OpenAI and Gemini providers are unit-tested against their documented wire shapes and were not run live in this repository.
3. Claude Code as an MCP client
Claude Code connects to the merchant's endpoint like any MCP client; the merchant's twelve tools become Claude Code's tools for the session. .mcp.json at the repository root registers two merchants, lumen-home (port 8016) and aurora-escapes (port 8017), so starting claude in the repository root and approving the project's servers is enough. To register the endpoint anywhere else:
claude mcp add --transport http lumen-home http://localhost:8016/api/ucp/mcp
claude mcp get lumen-home then reports Status: ✔ Connected with the URL, and /mcp inside a session lists the twelve tools. A prompt that makes the role explicit:
You are a shopping agent that does not belong to this store. Using only the lumen-home tools, find a table lamp under 80 dollars, create a checkout for one unit, and report the item, the total, the continue_url and the payment handlers offered. Do not claim to have paid.
Verified on 6 and 7 September 2026 with Stripe in test mode: Claude Code called search_catalog, read candidates with get_product, chose a $22 table lamp over a $54 desk lamp because the prompt said table lamp, called create_cart and create_checkout, and answered with the checkout id, the total, the Stripe continue_url, the two handlers, and a sentence that no payment was made. Paying on Stripe's page and then asking it to read the checkout again, which would make it call get_checkout and report status: completed with an order id, was not run in this repository.
The one-shot form needs no interactive session and no approval prompt; --allowedTools mcp__lumen-home pre-approves every tool from that server and nothing else, and --strict-mcp-config ignores any other MCP servers on the machine. A logged-in Claude Code needs no key; otherwise pass ANTHROPIC_API_KEY in the environment.
claude -p --mcp-config .mcp.json --strict-mcp-config --allowedTools mcp__lumen-home --output-format text "You are a shopping agent that does not belong to this store. Using only the lumen-home tools, find a table lamp under 80 dollars, create a checkout for one unit, and report the item, the total, the continue_url and the payment handlers. Do not claim to have paid."

The recording shows a real session: the prompt is typed, Claude Code calls the merchant's tools one by one with verbose output so each call shows its arguments and result, and the answer ends with Stripe's continue_url and the handlers, with no claim of having paid. docs/media/ also holds it as an MP4 and as an asciicast (.cast) for asciinema play. scripts/record_platform_agent.py made it: it drives an interactive Claude Code in a pseudo-terminal from a fresh config directory, answers the start-up dialogs before capture begins, types the prompt, renders with agg and ffmpeg, and discards the recording if any fragment of a key appears in a frame.
python scripts/record_platform_agent.py --mcp-config .mcp.json --server lumen-home --out docs/media/claude-code-platform-agent
4. Other platforms' clients
Neither protocol knows which model is on the other end, so any vendor's client can shop here. None of the following was run in this repository; the steps follow each vendor's published documentation.
ChatGPT, developer-mode connectors. ChatGPT's developer mode accepts a custom MCP connector by URL, which must be a public HTTPS endpoint speaking Streamable HTTP or SSE, so a local merchant needs a tunnel. Then add a connector for https://<your-tunnel-host>/api/ucp/mcp with no authentication and start a chat with it enabled; write actions such as create_checkout show a confirmation step in ChatGPT before they run. Treat the tunnel as public: anyone with the URL can stage checkouts on the merchant while it is up.
cloudflared tunnel --url http://localhost:8016
Vendor frameworks. The OpenAI Agents SDK (MCPServerStreamableHttp with the endpoint URL among an Agent's mcp_servers), Google ADK (MCPToolset with StreamableHTTPConnectionParams, run with adk run or adk web), Gemini CLI (an mcpServers entry with httpUrl in ~/.gemini/settings.json), and Codex CLI (~/.codex/config.toml) all connect to http://localhost:8016/api/ucp/mcp as MCP clients and list the same twelve tools.
Google's real agent. The Gemini app has no setting for adding an MCP server. Gemini as a shopping agent reaches merchants through Google's UCP program: a merchant onboards in Merchant Center, marks eligible listings, and gets sandbox access to validate checkout and identity linking before going live in AI Mode and Gemini. That sandbox is Google's, against a merchant account, and is the only way to see the real Gemini agent buy from a store.
Shopify's client as the proof of shape
tests/test_thirdparty.py::test_shopify_client_shops_at_a_stripe_merchant_over_ucp runs Shopify's UcpClient and ShopifyStorefrontBackend, vendored unchanged, against Lumen Home: search, details, cart writes with replace semantics, a staged checkout whose continue_url is the processor's page, and policies. The same test then completes the checkout with a com.google.pay credential on the simulated gateway and reads the order back. If it passes, a platform written for Shopify stores reads this merchant the same way.
python -m pytest tests/test_thirdparty.py -q
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
claude mcp add answers "An unknown error occurred (Unexpected)" and nothing else |
the terminal cannot read the current directory; on macOS the Claude desktop app's built-in terminal has no access to ~/Documents until it is granted under System Settings, Privacy & Security, Files and Folders |
run the command from Terminal.app, grant the access, or use .mcp.json and skip the command (checked 6 September 2026) |
| "Failed to authenticate. API Error: 401 OAuth access token has expired" | the Claude Code login lapsed | run claude and /login, or pass ANTHROPIC_API_KEY |
claude mcp list says "MCP endpoint not found at http://localhost:8016" |
the merchant API is not running, or an older process on that port predates the UCP endpoint | curl http://localhost:8016/api/health, then ./platforms/stripe/third-party/run.sh --serve |