x402 Payment Protocol
The x402 protocol enables seamless machine-to-machine payments using HTTP status codes. It extends HTTP with a payment flow based on the402 Payment Required status code.
How It Works
The payment flow is fully automated by the MCP server:Server returns HTTP 402
The first request returns HTTP 402 with a
payment-required header containing payment requirements (amount, recipient, asset, network).Client signs payment
The MCP client signs a USDC transfer authorization using EIP-3009 (TransferWithAuthorization) — no on-chain transaction needed at this point.
Retry with signature
The request is retried with the payment signature in the
payment-signature header.Server verifies and settles
The server verifies the signature, settles the USDC transfer on-chain (Base network), and creates the order.
EIP-3009: TransferWithAuthorization
The payment uses EIP-3009 which allows gasless USDC transfers via signed authorizations:- No gas needed — The wallet signs a typed data message (EIP-712), not a transaction
- Server submits — The server submits the authorization on-chain
- USDC only — Only works with USDC on Base network
- Time-bounded — Authorization has
validAfterandvalidBeforetimestamps - Nonce-protected — Each authorization uses a unique random nonce