What is x402?
x402 is an open payment protocol that uses the HTTP402 Payment Required status code to enable instant stablecoin payments over HTTP. Instead of API keys or subscriptions, you pay per request with USDC.
The protocol was created by Coinbase and is designed for both human users and AI agents.
The payment flow
Request a protected resource
Your agent sends a normal HTTP request to a paywalled endpoint (like
GET /get-card?amount=50).Server returns 402
The server responds with
402 Payment Required and a JSON body describing the price and how to pay.Client signs a payment
Your x402 client library reads the payment requirements, constructs an EIP-3009
transferWithAuthorization payload, and signs it with your wallet’s private key. No on-chain transaction is submitted — just a signature.Client retries with payment header
The client replays the original request with an
X-PAYMENT header containing the signed payment.The 402 response
When you hit a paywalled endpoint without paying, you get back a JSON body like this:| Field | Description |
|---|---|
scheme | Payment method — "exact" means pay the exact amount |
network | Blockchain network in CAIP-2 format (eip155:8453 = Base mainnet) |
maxAmountRequired | Amount in token base units (6 decimals for USDC, so 5000000 = $5) |
payTo | Wallet address that receives the payment |
asset | USDC token contract address on Base |
Key concepts
Your wallet signs, the facilitator pays gas
Your agent never submits a blockchain transaction. It only signs an authorization (EIP-3009transferWithAuthorization). The facilitator — hosted by Coinbase — handles the on-chain settlement and pays gas fees.
Client libraries handle everything
If you use@x402/axios or @x402/fetch, the entire 402 → sign → retry flow happens automatically. Your code looks like a normal HTTP request:
Base mainnet + USDC
Laso Finance uses USDC on Base (Coinbase’s L2). Base has low gas fees and fast finality, making it ideal for microtransactions like the $0.001/auth endpoint.
The three actors
| Actor | Role | Example |
|---|---|---|
| Client | Signs payment authorizations with a wallet | Your AI agent using @x402/axios |
| Resource server | Protects endpoints behind a paywall, verifies payments | Laso Finance API at laso.finance |
| Facilitator | Verifies signatures and settles payments on-chain | Coinbase’s hosted facilitator |
Supported networks
x402 is chain-agnostic. The current ecosystem supports:| Network | CAIP-2 ID | Token |
|---|---|---|
| Base mainnet | eip155:8453 | USDC |
| Base Sepolia (testnet) | eip155:84532 | USDC |
| Ethereum mainnet | eip155:1 | USDC |
| Solana mainnet | solana:mainnet | USDC |
eip155:8453) exclusively.
Further reading
x402 Protocol
Official x402 protocol site and whitepaper.
x402 GitHub
Open-source protocol specification and client libraries.