Building Agentic Commerce #5: UCP — Shopify's Universal Commerce Protocol in Practice
How UCP (Universal Commerce Protocol) enables AI agents to discover stores, create checkouts, link shopper identity, and fetch real-time catalog data — with production code examples.
Executive summary
Part 5 of 'Building Agentic Commerce' explains UCP — Google and Shopify's Universal Commerce Protocol. Covers protocol detection (3 confidence levels), discovery via /.well-known/ucp, 6-state checkout lifecycle, SCP identity linking with loyalty tiers, real-time catalog capability, AP2 mandate delegation, 5 MCP tools, and 215 tests.
Published
2026-04-06
14 min
Author
Trusteed Engineering
Core Protocol Team
Category
developer-guide
In Parts <a href='/en/blog/building-agentic-commerce-multi-protocol-checkout'>1</a>, <a href='/en/blog/building-agentic-commerce-agent-discovery-nlweb'>2</a>, <a href='/en/blog/building-agentic-commerce-trust-scores'>3</a>, and <a href='/en/blog/building-agentic-commerce-x402-stablecoin-payments'>4</a> we covered multi-protocol checkout, agent discovery, trust scores, and x402 stablecoin payments. Now we tackle the protocol backed by Google and Shopify with 30+ partners: <strong>UCP — the Universal Commerce Protocol</strong>.
What is UCP?
Discovery: /.well-known/ucp
Protocol Detection
The UCP inbound adapter uses three confidence levels to identify UCP requests:
- 1<code>UCP-Agent</code> header present → confidence <strong>1.0</strong> (explicit declaration)
- 2Body contains <code>capabilities</code> array → confidence <strong>0.9</strong>
- 3Body matches UcpCheckout Zod schema → confidence <strong>0.85</strong> (shape detection)
UCP is registered 4th in the protocol plugin registry (after ACP, AP2, x402). When multiple protocols match, the highest-confidence adapter wins. If no protocol is detected, ACP is used as the default fallback at confidence 0.5.
The 6-State Checkout Lifecycle
Normalization: UcpCheckout → AgentPaymentIntent
SCP Identity Linking
UCP natively integrates with SCP (Shopper Context Protocol) for identity verification and loyalty data. The flow uses OAuth 2.0:
- 1<strong>Shopify</strong>: Reads customer metafields (namespace <code>loyalty</code>) via Storefront GraphQL. Maps tier to discount: gold = 10%, silver = 5%, bronze = 0%.
- 2<strong>WooCommerce</strong>: Fetches points balance via <code>/wp-json/wc/v1/customers/{id}/points</code>. Returns <code>loyaltyPoints</code> count. Graceful fallback if loyalty plugin not installed.
Real-Time Catalog (Phase B)
AP2 Mandate Delegation
Error Handling: Severity-Based Model
UCP vs ACP: When to Use Which
Both protocols normalize to the same <code>AgentPaymentIntent</code> internal format and share the same KYAI policy engine. From the platform's perspective, UCP and ACP are just different protocol adapters — the checkout logic is identical.
MCP Tools for UCP
- 1<code>ucp_create_checkout</code> — Create a UCP checkout session from line items
- 2<code>ucp_get_checkout</code> — Fetch checkout details by ID
- 3<code>ucp_update_checkout</code> — Modify items or totals
- 4<code>ucp_complete_checkout</code> — Finalize and trigger payment
- 5<code>ucp_cancel_checkout</code> — Cancel an active session
Merchant Configuration
Test Coverage
The UCP implementation is backed by 215 tests across 22 test files. Coverage includes: inbound detection (25 tests), outbound translation (20 tests), checkout mapping (18 tests), error mapping (12 tests), AP2 delegation (20 tests), discovery profiles (25 tests), configuration validation (10 tests), integration end-to-end (30 tests), catalog service (40+ tests), identity service (35+ tests), and MCP tools (10 tests). All tests use pure function patterns with immutable data.
What's Next
Frequently asked questions
What is UCP and who created it?
UCP (Universal Commerce Protocol) is an open protocol designed by Google and Shopify with 30+ partners. It standardizes how AI agents interact with commerce platforms — from product discovery to checkout to identity linking.
How is UCP different from ACP?
UCP has a 6-state checkout lifecycle (vs ACP's 4), a capability extension namespace (dev.ucp.*), native SCP identity linking for loyalty data, real-time catalog access, and supports 5 transport bindings (REST, MCP, A2A, AG-UI, Embedded). ACP is Stripe-centric with simpler checkout flows.
Can UCP and ACP coexist on the same store?
Yes. Both protocols normalize to the same AgentPaymentIntent format and share the KYAI policy engine. The protocol detector routes each request to the correct adapter based on confidence scoring. A store can have both UCP and ACP enabled simultaneously.
What is SCP identity linking in UCP?
SCP (Shopper Context Protocol) enables agents to link shopper identity and access loyalty data via OAuth 2.0. Agents can read loyalty tiers (gold/silver/bronze), fetch points balances, and apply loyalty discounts at checkout.
How does UCP real-time catalog work?
When a merchant enables dev.ucp.catalog.realtime, agents can fetch live prices and inventory via GET /{slug}/ucp/catalog. Data is cached for 30 seconds with a freshness_ms field showing staleness. The service fetches from Shopify Storefront GraphQL or WooCommerce REST API.
Sources and references
- Universal Commerce Protocol Specification
UCP Working Group (Google + Shopify)
- Shopper Context Protocol (SCP)
SCP Working Group
- MCP Specification — Model Context Protocol
Anthropic
Related articles
developer-guide
Building Agentic Commerce #1: Multi-Protocol Checkout — MCP + x402 + ACP in One Flow
One agent, three protocols, one checkout. Here's how MCP, x402 stablecoin payments, and ACP work together to let AI agents buy products — with code examples you can run today.
developer-guide
Building Agentic Commerce #4: x402 Stablecoin Payments — When Agents Pay in USDC
How AI agents make on-chain USDC payments using the x402 protocol — multi-chain settlement, EIP-712 signatures, and production-ready stablecoin checkout.
integration-guide
Shopify MCP vs WooCommerce MCP: A Developer's Comparison
A deep-dive comparison of the Shopify and WooCommerce MCP connectors — authentication, sync mechanisms, data models, and architecture patterns for agentic commerce.