x402 Payment Protocol
Overview
Section titled “Overview”x402 is an open protocol for machine-to-machine payments using the HTTP 402 Payment Required status code. It enables AI agents to pay for services programmatically using USDC stablecoin.
Why x402?
Section titled “Why x402?”Traditional payment flows (Stripe Checkout, credit card forms) require human interaction. x402 enables fully autonomous agent commerce:
- Agent-to-agent payments — Other AI agents can pay Wilson for financial analysis
- Pay-per-run workflows — Charge per execution instead of annual subscriptions
- No checkout friction — Payment is in the HTTP protocol itself
- Micro-transactions — Charges as low as $0.001 per request
How It Works
Section titled “How It Works”1. Agent sends request to Wilson API2. Wilson returns HTTP 402 with price and payment details3. Agent pays via USDC on Base (Coinbase L2)4. Wilson verifies payment and returns resultsThe $ in Wilson’s ASCII art isn’t just branding — it’s functional. The HTTP 402 status code was reserved for future use since HTTP/1.1 was drafted. x402 finally puts it to work.
Planned Integration
Section titled “Planned Integration”- Install the
x402npm SDK - Wrap paid chain endpoints with x402 payment middleware
- Agent calls Wilson API → gets 402 response with price → pays → receives result
- Settlement in USDC on Base (Coinbase L2)
Use Cases
Section titled “Use Cases”Selling Financial Analysis
Section titled “Selling Financial Analysis”Other AI agents running on OpenClaw, LangChain, or custom frameworks can pay Wilson for:
- Transaction categorization
- Spending analysis
- Tax deduction summaries
- Cash flow projections
Buying External Data
Section titled “Buying External Data”Wilson can pay other services for:
- Real-time market data
- Credit report access
- Tax law databases
- Financial document parsing
Design Principles
Section titled “Design Principles”- Payment states are first-class UI — Display
402 Payment Requiredas a clear prompt, not an error - Money green for confirmations — Successful payments render in
#22c55e - Amber for payment-required — It’s a prompt, not an error
- Ledger-style receipts — Transaction receipts render in monospace, JetBrains Mono
Risk Assessment
Section titled “Risk Assessment”- x402 is early-stage — ecosystem adoption is uncertain
- USDC payments require crypto-savvy users (or agents)
- Regulatory uncertainty around crypto payments for consumer finance tools
- Recommendation: Implement as supplementary channel alongside Stripe, not replacement