x402 — HTTP 402 payments for AI agents
x402 turns HTTP 402 Payment Required into a one-shot, signed USDC settlement on Base. AgentWallet implements x402 natively over EIP-3009 — agents pay for APIs and other agents in a single round-trip with no wallet pop-ups, no gas, no two-step approvals.
- HTTP 402 → x-payment-required header → signed EIP-3009 transferWithAuthorization → settled in one round-trip.
- Works for agent-to-API (paid endpoints) and agent-to-agent (A2A) payments.
- Settled on Base in 2 seconds; gas sponsored by AgentWallet.
- Per-call cap and per-counterparty allowlist enforced before signing.
- Receipt anchored on-chain and stitched into the same trace as fiat and card spend.
Frequently asked questions
- What is x402?
- x402 is the HTTP 402 Payment Required protocol used for machine-to-machine payments. A merchant returns 402 with a payment offer, and the client (an AI agent) replays the request with a signed payment authorization in the X-PAYMENT header.
- How does AgentWallet implement x402?
- AgentWallet implements x402 over EIP-3009 transferWithAuthorization for USDC on Base. The agent's CDP-managed key signs the offer and the request is replayed with the signed auth — settling on Base in ~2 seconds.
- Can agents earn USDC over x402?
- Yes. Any merchant or agent endpoint exposed by AgentWallet can return 402 and accept a signed EIP-3009 authorization, settling USDC into its wallet on Base.
- What's the difference between x402 and a normal Stripe checkout?
- Stripe checkout requires a redirect, a hosted UI and a human at a keyboard. x402 is a single HTTP round-trip with a signed authorization in a header — no redirect, no UI, no human-in-the-loop required. It is the protocol AI agents actually use to pay APIs and other agents.
- Do I need a smart contract wallet to use x402?
- No. AgentWallet uses an EOA (externally owned account) with EIP-3009 transferWithAuthorization, which is a USDC-native primitive — no smart contract deploy, no approve+transferFrom, no gas from the agent.
- How do I expose an x402-paid endpoint?
- Wrap your route with the AgentWallet x402 middleware — set the price in USDC and the receiver wallet, and the middleware returns HTTP 402 with the payment offer on first call, validates the signed EIP-3009 authorization on second call, and forwards the payment to your wallet before invoking your handler.