/ x402 v2 specification
Protocol reference.
The complete x402 v2 protocol: request/response headers, JSON schemas, EIP-712 typed data structures, supported networks and contract addresses.
1. Client sends initial request
A standard HTTP request to a protected resource. No special headers required on the first attempt.
2. Server returns 402 + payment-required
The response includes a `payment-required` header: a Base64-encoded JSON object specifying x402 version, accepted payment methods, amounts, receiver address, and resource identifier.
3. Client signs payment
The wallet parses the requirements, selects EIP-3009 or Permit2, constructs the EIP-712 typed data, and signs with the user's private key.
4. Client retries with payment-signature
The original request is replayed with a `payment-signature` header containing the signed authorization payload (Base64-encoded JSON).
5. Server verifies and serves
The server decodes the signature, submits the meta-transaction (EIP-3009) or settlement tx (Permit2) on-chain, confirms receipt, and returns the resource with a `payment-response` header.
payment-required header schema
{
"x402Version": 2,
"accepts": [
{
"scheme": "eip3009",
"network": "base",
"token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"maxAmountRequired": "100000",
"resource": "/api/inference",
"description": "GPU inference — 1 request",
"mimeType": "application/json",
"payTo": "0x...facilitator",
"extra": {}
}
]
}Supported networks
x402 v2 supports USDC settlement on the following EVM networks:
| Chain | Chain ID | USDC address |
|---|---|---|
| Ethereum | 1 | 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 |
| Polygon | 137 | 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359 |
| Base | 8453 | 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 |
| Arbitrum | 42161 | 0xaf88d065e77c8cC2239327C5EDb3A432268e5831 |
| Optimism | 10 | 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85 |
| BSC | 56 | 0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d |
EIP-712 typed data
Both signing methods use EIP-712 structured data for security and readability. The wallet displays human-readable fields before the user signs.
EIP-3009 types
TransferWithAuthorization(
address from,
address to,
uint256 value,
uint256 validAfter,
uint256 validBefore,
bytes32 nonce
)Permit2 types
PermitWitnessTransferFrom(
TokenPermissions permitted,
address spender,
uint256 nonce,
uint256 deadline,
X402Witness witness
)
TokenPermissions(
address token,
uint256 amount
)Last updated: