Universal Commerce Protocol
Production-ready Rust server implementing the Universal Commerce Protocol for modern e-commerce checkout flows with agent-native communication.
REST + gRPC + MCP + A2A in a single, cryptographically-secured handler.
What is Universal Commerce Protocol?
UCP is an open standard for e-commerce checkout that enables seamless communication between AI agents, platforms, and merchants. It provides a unified interface for creating, managing, and completing purchases with cryptographic security and multi-protocol support.
Checkout State Machine
Four Protocols, One Handler
Connect via REST, gRPC, MCP for AI agents, or A2A for agent-to-agent communication
REST + JSON
Standard HTTP/HTTPS with JSON payloads and JWS signature verification
UCP Capabilities
Modular extensions for checkout, orders, fulfillment, discounts, and more
Checkout Session
dev.ucp.shopping.checkoutCreate, update, and complete checkout sessions with full lifecycle management
API Endpoints
Complete REST API for checkout lifecycle management with JWS signatures and idempotency support.
/api/checkout-sessions/api/checkout-sessions/:id/api/checkout-sessions/:id/api/checkout-sessions/:id/complete/api/checkout-sessions/:id/cancel/api/orders/:id/tokenize/.well-known/ucp// Create a checkout session via UCP
const response = await fetch(
'https://ucp.stateset.io/api/checkout-sessions',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'UCP-Agent': 'profile="https://myapp.com/profile"',
'Request-Id': crypto.randomUUID(),
'Request-Signature': '<jws-detached-signature>'
},
body: JSON.stringify({
line_items: [
{ item: { id: 'item_123' }, quantity: 2 }
],
currency: 'USD',
buyer: {
email: 'buyer@example.com',
first_name: 'John',
last_name: 'Doe'
},
payment: {
selected_instrument_id: 'pi_demo',
instruments: [{
id: 'pi_demo',
type: 'card'
}]
},
fulfillment: {
methods: [{
type: 'shipping',
destinations: [{
id: 'dest_1',
street_address: '123 Main St',
city: 'San Francisco',
state: 'CA',
postal_code: '94102'
}],
selected_destination_id: 'dest_1'
}]
},
discounts: {
codes: ['SAVE10']
}
})
}
);
const checkout = await response.json();
// { id: "chk_xxx", status: "ready_for_complete", ... }Discovery Endpoint
GET /.well-known/ucpAdvertises protocol version, supported capabilities, payment handlers, signing keys (JWK format), and service endpoints.
Cryptographic Security
JWS + ECDSAAll requests and responses are signed with JWS (JSON Web Signature) using ES256/ES384 ECDSA cryptography for tamper-proof communication.
Embedded iCommerce Engine
Full commerce backend with real inventory, dynamic pricing, tax calculation, and promotions
SQLite Persistence
Durable checkout and order storage at ./commerce.db
Real Inventory
Stock reservation and fulfillment tracking
Dynamic Promotions
Percentage off, fixed amount, BOGO, tiered discounts
Multi-Jurisdiction Tax
Address-based tax calculation with dynamic rates
Language Bindings
Native bindings for multiple programming languages
Node.js
@stateset/ucp-handler-nodeN-APIPython
stateset-ucpPyO3Go
github.com/stateset/ucp-goCGORuby
stateset-ucprb-sysUse Cases
Standardized commerce for AI agents, platforms, and merchants
Agent-Driven Ecommerce
AI agents execute purchases via MCP/A2A protocols with full checkout lifecycle
Multi-Platform Commerce
Unified checkout experience across multiple sales channels and marketplaces
Secure Payments
JWS-signed transactions with complete audit trail for compliance
Identity-Linked Payments
OAuth identity binding for seamless repeat customer experiences
Real-Time Fulfillment
Dynamic shipping options with carrier integration and inventory awareness
Promotion Engine
Complex business rules for discounts, incentives, and loyalty programs
Ready to Implement UCP?
Deploy the Universal Commerce Protocol for agent-native checkout flows