An interactive demonstration of four leading agentic payment protocols that enable AI agents to conduct commerce autonomously or with user authorization.
cd agentic-payments-demo
npm install
npm startThen open http://localhost:3000 in your browser.
This demo illustrates the fundamental problem of agentic payments: How can AI agents make purchases on behalf of users securely, transparently, and at scale?
Each protocol takes a radically different approach to solving this problem:
| Protocol | Core Philosophy |
|---|---|
| ACP | "Keep humans in the loop with seamless UX" |
| AP2 | "Trust through cryptographic proof" |
| x402 | "Make payments as simple as HTTP requests" |
| MCP | "Standardize tools so any AI can pay" |
What it demonstrates: The ACP demo shows how a user can complete a purchase without ever leaving their chat interface. When you click "Create Checkout Session," you're simulating what happens when a user says "Buy me a wireless mouse" to ChatGPT.
What to observe:
- The
presentationDatafield - this is structured data the AI uses to display the checkout to users - The
agentContexttells the AI what actions are allowed - The session has an expiration time for security
- Confirmation happens in a second step, simulating user approval
Real-world example:
User: "Order me the cheapest AirPods from Amazon" ChatGPT: Shows inline checkout card with price, image, delivery estimate User: Clicks "Confirm" button in chat Payment processed via Stripe without leaving the conversation
What it demonstrates: The AP2 demo shows how a user can give an AI agent permission to spend money autonomously within defined constraints. This is the most sophisticated protocol for truly autonomous agents.
What to observe:
- Intent Mandate: Pre-authorization with limits (max $100, only electronics, expires in 24h)
- Cart Mandate: Explicit approval for a specific cart (cryptographically signed)
- Payment Mandate: Created automatically to signal AI involvement to payment networks
- Each mandate has a cryptographic signature for non-repudiation
- The
auditTrailin payment responses provides full accountability
The key insight: AP2 solves the "who authorized this?" problem. If an AI agent buys something wrong, the audit trail proves:
- What constraints the user set (Intent Mandate)
- Whether the purchase was within constraints
- That the AI was involved (disclosed to payment network)
Real-world example:
User: "You can spend up to $50/day on office supplies without asking me" [Agent creates Intent Mandate with constraints] Later, agent notices printer ink is low, finds ink for $35 Agent purchases autonomously using the mandate User receives notification with full audit trail
What it demonstrates: The x402 demo shows a fundamentally different model: machine-to-machine payments without any prior relationship. No API keys, no subscriptions, no accounts—just pay and access.
What to observe:
- First request returns HTTP
402 Payment Requiredwith payment details - The
paymentRequirementsarray lists accepted payment methods (USDC on Base network) - Agent wallet has a balance that decreases with each payment
- Payment signature is sent as an HTTP header on retry
- Resource is returned only after valid payment
The key insight: x402 enables a new economic model where:
- APIs can monetize without user management overhead
- AI agents can access any x402-enabled resource autonomously
- Payments happen in real-time with stablecoins (no chargebacks, instant settlement)
- Micropayments are practical ($0.001 per request)
Real-world example:
AI Agent needs premium weather data for user's travel planning Agent has a USDC wallet with $10 balance Agent requests weather API → gets 402 Agent signs 0.001 USDC payment → gets weather data No API key needed, no rate limits, just pay-per-use
What it demonstrates: The MCP demo shows how payments can be exposed as standardized tools that any AI can discover and use. This is the most "AI-native" approach—payments become just another tool in the AI's toolkit.
What to observe:
listTools()returns a schema-defined list of payment capabilities- Each tool has
inputSchemadescribing required parameters - Tool responses include
contextwith next suggested actions - The AI can chain tools together (create intent → list methods → confirm)
- Multiple providers (Adyen, Worldpay) use the same interface
The key insight: MCP treats payments like any other AI capability. Just as an AI can use a "search the web" tool or "read a file" tool, it can use "create_payment_intent" or "refund_payment" tools. This standardization means:
- Any MCP-compatible AI can make payments
- Payment providers compete on implementation, not interface
- AI can reason about payment options using structured schemas
Real-world example:
User: "Refund the customer's order from yesterday" AI calls
get_payment_statusto find the payment AI callsrefund_paymentwith the payment ID AI reports: "Refund of $49.99 processed, confirmation #RF123"
┌─────────────────────────────────────────────────────────────────────────┐
│ AGENTIC PAYMENTS SPECTRUM │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Human-in-Loop ◄─────────────────────────────────────────► Autonomous │
│ │
│ ACP MCP AP2 x402 │
│ │ │ │ │ │
│ User confirms User may or User sets No user │
│ every purchase may not be constraints, involved │
│ involved agent acts │
│ │
└─────────────────────────────────────────────────────────────────────────┘
┌────────────────┬────────────────┬────────────────┬────────────────┐
│ ACP │ AP2 │ x402 │ MCP │
├────────────────┼────────────────┼────────────────┼────────────────┤
│ │ │ │ │
│ ┌───────┐ │ ┌───────┐ │ ┌───────┐ │ ┌───────┐ │
│ │Stripe │ │ │ Any │ │ │Crypto │ │ │Adyen/ │ │
│ │ API │ │ │Network│ │ │Wallet │ │ │Worldpay │
│ └───┬───┘ │ └───┬───┘ │ └───┬───┘ │ └───┬───┘ │
│ │ │ │ │ │ │ │ │
│ Traditional │ Agnostic │ Blockchain │ Traditional │
│ Card Rails │ (card/crypto)│ (USDC) │ Card Rails │
│ │ │ │ │
└────────────────┴────────────────┴────────────────┴────────────────┘
| Aspect | ACP | AP2 | x402 | MCP |
|---|---|---|---|---|
| Who authorizes? | User (per-transaction) | User (via mandates) | Agent wallet holder | Depends on implementation |
| Proof of authorization | Session confirmation | Cryptographic VDC signature | Blockchain transaction | Application logs |
| Dispute resolution | Stripe/card network | Audit trail + VDCs | On-chain history | Provider-specific |
| Fraud liability | Merchant/Stripe | Defined by mandate | Wallet holder | Provider-specific |
| Aspect | ACP | AP2 | x402 | MCP |
|---|---|---|---|---|
| Integration effort | Low (Stripe SDK) | Medium (VDC handling) | Low (HTTP headers) | Medium (MCP server) |
| Prerequisites | Stripe account | VDC infrastructure | Crypto wallet | MCP-compatible AI |
| Latency | ~2-3 seconds | ~1-2 seconds | ~400ms (Solana) | ~2-3 seconds |
| Transaction cost | 2.9% + $0.30 | Network fees | ~$0.0003 (Base) | Provider fees |
| Minimum practical amount | ~$1 | ~$1 | $0.0001 | ~$1 |
- Building consumer-facing chat commerce (ChatGPT plugins, customer service bots)
- You want proven infrastructure (Stripe's reliability)
- Users should confirm every purchase
- Traditional payment methods (cards) are required
- You need chargebacks and consumer protection
- Building truly autonomous agents that shop on behalf of users
- Regulatory compliance and audit trails are critical
- You need cryptographic proof of user intent
- Working with enterprise clients who need accountability
- Supporting multiple payment networks (cards + crypto)
- Monetizing APIs without user management
- Enabling AI-to-AI commerce (agents paying agents)
- Micropayments are needed ($0.001 - $1 range)
- Instant, irreversible settlement is acceptable
- You want to avoid subscription/API key management
- Building AI systems that need flexible payment capabilities
- Working with multiple payment providers
- Want AI to reason about payment options
- Need payments integrated into larger tool ecosystems
- Building internal enterprise AI with existing payment providers
ACP's philosophy is that checkout should feel native to wherever the user is. Instead of redirecting users to a checkout page, ACP brings the checkout into the chat.
Key design decisions:
presentationDataprovides structured display info so any AI can render checkout consistentlyagentContexttells the AI what UX patterns are allowed- Sessions expire quickly (30 min) to prevent stale carts
- Two-step flow (create → confirm) ensures user approval
// ACP returns data optimized for AI presentation
{
presentationData: {
title: "Purchase from Demo Store",
summary: "1 item(s) • USD 29.99",
callToAction: "Confirm Purchase"
}
}AP2's philosophy is that autonomous agents need cryptographic accountability. The protocol answers three critical questions:
- Authorization: How do we know the user allowed this?
- Authenticity: How do we know this reflects user intent?
- Accountability: Who is liable if something goes wrong?
Key design decisions:
- Verifiable Digital Credentials (VDCs) are tamper-evident and cryptographically signed
- Intent Mandates separate "permission to spend" from "specific purchase"
- Payment Mandates explicitly disclose AI involvement to payment networks
- All signatures create an immutable audit trail
// AP2 creates cryptographic proof chain
{
credentials: {
userMandate: "vdc:abc123...", // User's authorization
paymentMandate: "vdc:def456...", // AI involvement disclosure
signatures: ["sig_...", "sig_..."] // Cryptographic proof
}
}x402's philosophy is that payments should be as simple as HTTP. The 402 status code has existed since HTTP/1.0 but was never standardized. x402 finally defines how it should work.
Key design decisions:
- Uses existing HTTP infrastructure (no new protocols)
- Payment requirements returned as structured headers
- Stablecoins enable instant, irreversible micropayments
- No accounts, API keys, or prior relationship needed
// x402 is just HTTP with payment headers
// Request without payment:
GET /api/premium/weather → 402 Payment Required
// Request with payment:
GET /api/premium/weather
Header: PAYMENT-SIGNATURE: <base64_signed_payment>
→ 200 OK + dataMCP's philosophy is that AI capabilities should be discoverable and standardized. Payments become tools that any AI can find, understand, and use through a common interface.
Key design decisions:
- Tools are self-describing with JSON schemas
- Responses include context for AI reasoning
- Provider-agnostic (Adyen and Worldpay expose same interface)
- Composable (chain tools together for complex workflows)
// MCP tools are self-describing
{
name: "create_payment_intent",
description: "Create a new payment intent",
inputSchema: {
type: "object",
properties: {
amount: { type: "number" },
currency: { type: "string" }
},
required: ["amount", "currency"]
}
}These protocols are not mutually exclusive. We're already seeing convergence:
- AP2 + x402: Google's "A2A x402 extension" combines AP2's VDCs with x402's crypto payments
- MCP + x402: Vercel's "x402-mcp" exposes x402 payments as MCP tools
- AP2 + ACP: Could combine Stripe's UX with AP2's audit trails
The likely future is a layered stack:
┌────────────────────────────────────────┐
│ Application Layer (Chat UX, etc.) │ ← ACP-style presentation
├────────────────────────────────────────┤
│ Authorization Layer (Mandates) │ ← AP2-style credentials
├────────────────────────────────────────┤
│ Tool Layer (Standardized APIs) │ ← MCP-style tools
├────────────────────────────────────────┤
│ Settlement Layer (Payment Rails) │ ← x402/traditional
└────────────────────────────────────────┘
What it is: A protocol enabling seamless checkout within AI chat interfaces like ChatGPT.
Key Features:
- User stays within the chat experience
- Leverages Stripe's existing payment infrastructure
- Structured presentation data for AI to display to users
Flow:
User → "Buy me a wireless mouse"
↓
AI Agent → Creates ACP checkout session
↓
Chat UI → Shows inline checkout with item details
↓
User → Confirms purchase in chat
↓
Stripe → Processes payment
↓
AI Agent → Returns confirmation + receipt
API Endpoints:
POST /api/acp/checkout- Create checkout sessionPOST /api/acp/confirm/:sessionId- Confirm payment
What it is: An open protocol using Verifiable Digital Credentials (VDCs) to establish trust in AI agent transactions. Released under Apache 2.0 with 60+ industry partners.
Key Concepts:
| Mandate Type | Use Case | User Presence |
|---|---|---|
| Intent Mandate | Pre-authorized autonomous purchases | Human NOT present |
| Cart Mandate | Explicit approval for specific cart | Human present |
| Payment Mandate | Signals AI involvement to networks | Sent to payment network |
Flow (Autonomous with Intent Mandate):
User → Creates Intent Mandate
"Allow agent to spend up to $50 on electronics"
↓
AI Agent → Finds headphones for $35
↓
AI Agent → Validates against mandate constraints
↓
AP2 → Creates Payment Mandate (for audit trail)
↓
Payment Network → Processes with AI disclosure
↓
Full audit trail with cryptographic signatures
API Endpoints:
POST /api/ap2/mandate/intent- Create autonomous spending mandatePOST /api/ap2/mandate/cart- Create explicit cart authorizationPOST /api/ap2/pay- Initiate payment with mandate
What it is: A protocol leveraging the HTTP 402 "Payment Required" status code for machine-to-machine payments. No API keys or subscriptions needed—just pay per request.
Key Features:
- Built into HTTP - no additional protocols
- Real-time stablecoin payments (USDC)
- Ideal for AI agents accessing paid APIs autonomously
- 35M+ transactions processed
Flow:
AI Agent → GET /api/premium/weather
↓
Server → 402 Payment Required
{
"amount": 0.001,
"asset": "USDC",
"network": "base",
"recipient": "0x..."
}
↓
Agent Wallet → Signs USDC payment
↓
AI Agent → GET /api/premium/weather
Header: PAYMENT-SIGNATURE: <signed_payment>
↓
Server → Verifies payment on-chain
↓
Server → 200 OK + Weather Data
API Endpoints:
GET /api/x402/resources- List paid resourcesGET /api/x402/resource/*- Access resource (returns 402 if unpaid)POST /api/x402/create-payment- Create payment signaturePOST /api/x402/access- Access with payment
What it is: Payment integrations built on Anthropic's Model Context Protocol, with implementations from Adyen, Worldpay, J.P. Morgan, and others.
Key Features:
- Standardized tool interface for payment operations
- Context-aware payments tied to conversation flow
- Multi-provider support
- Structured responses for AI reasoning
Available Tools:
| Tool | Description |
|---|---|
create_payment_intent |
Create a new payment intent |
confirm_payment |
Confirm and process payment |
get_payment_status |
Check payment status |
list_payment_methods |
List customer's saved methods |
create_checkout_session |
Create hosted checkout |
refund_payment |
Process refund |
Flow:
AI Agent → execute("create_payment_intent", {
amount: 49.99,
currency: "USD"
})
↓
MCP Server → Returns paymentIntentId + context
↓
AI Agent → execute("list_payment_methods", {
customerId: "cust_123"
})
↓
AI Agent → execute("confirm_payment", {
paymentIntentId: "pi_...",
paymentMethodId: "pm_visa_4242"
})
↓
MCP Server → Returns receipt + next actions
API Endpoints:
GET /api/mcp/tools- List available toolsPOST /api/mcp/execute- Execute a toolPOST /api/mcp/process-payment- High-level payment flow
| Feature | ACP | AP2 | x402 | MCP |
|---|---|---|---|---|
| Developer | Stripe/OpenAI | Coinbase | Anthropic + Partners | |
| Primary Use | In-chat checkout | Autonomous agents | Pay-per-API | Tool-based payments |
| Payment Type | Traditional cards | Any (agnostic) | Stablecoins (USDC) | Traditional cards |
| User Presence | Required | Optional | Not required | Flexible |
| Audit Trail | Standard | Cryptographic VDCs | Blockchain | Logging |
| Micropayments | No | Limited | Yes ($0.0001+) | No |
| Autonomy Level | Low | High | Highest | Medium |
| Integration Complexity | Low | Medium-High | Low | Medium |
| License | Proprietary | Apache 2.0 | Open standard | Open protocol |
agentic-payments-demo/
├── src/
│ ├── server.js # Express server with all endpoints
│ └── protocols/
│ ├── acp.js # Agentic Commerce Protocol
│ ├── ap2.js # Agent Payment Protocol
│ ├── x402.js # HTTP 402 Protocol
│ └── mcp-payments.js # MCP Payments
├── public/
│ └── index.html # Interactive demo UI
├── package.json
└── README.md
- Agentic Commerce Protocol - Stripe Docs
- Agent Payment Protocol (AP2) - Google's open protocol
- x402 Protocol - Coinbase's HTTP 402 standard
- x402 Whitepaper - Technical specification
- Model Context Protocol - Anthropic's MCP
- Worldpay MCP - Payment MCP server
- Adyen MCP - Adyen's MCP integration
- Visa Trusted Agent Protocol - Visa's approach
- Mastercard Agent Pay - Mastercard's approach