x402 Payment Schemes
x402 servers advertise accepted payment schemes in the PAYMENT-REQUIRED header. Each scheme specifies a payment method, network, and amount encoding. Clients select the first scheme they support.
exact
activeThe exact payment scheme requires a precise USDC payment on Base. The server specifies the amount, token contract address, and recipient address. The client transfers exactly that amount. The facilitator verifies the on-chain transaction before the server grants access.
The exact scheme is the primary x402 payment scheme supported by the Coinbase facilitator. It encodes a fixed payment requirement: the client must transfer exactly the specified amount of the specified token (USDC) to the specified address on Base L2.
The maxAmountRequired field uses the token's smallest denomination (USDC has 6 decimal places: 1000000 = $1.00 USDC).
The facilitator validates: the transaction hash exists on Base, amounts and addresses match the requirement, the transaction is confirmed, and the hash has not been used before (replay protection).
| Field | Required | Description |
|---|---|---|
scheme | Required | Must be the string 'exact' |
network | Required | Blockchain network: 'base' (mainnet) or 'base-sepolia' (testnet) |
maxAmountRequired | Required | Token amount in smallest denomination. USDC: 1000000 = $1.00 |
resource | Required | URI of the resource being paid for |
payTo | Required | Recipient wallet address on the network |
description | Optional | Human-readable description of what is being purchased |
// PAYMENT-REQUIRED decoded
{
"schemes": [{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "10000",
"resource": "https://api.example.com/api/premium",
"description": "Premium data API call – $0.01 USDC",
"payTo": "0x1234567890abcdef1234567890abcdef12345678"
}]
}usdcBase
activeThe usdcBase payment scheme is an explicit named alias for USDC payments on Base. It carries the same semantics as exact but makes the token and network explicit in the scheme name, simplifying client-side filtering in multi-scheme payment requirements.
usdcBase emerged as an explicit scheme identifier as x402 expanded to multiple tokens and networks. While exact can specify any token on any network, usdcBase makes the token and network explicit in the identifier itself.
This is useful when a server wants to advertise specifically USDC-on-Base support. Clients that only support USDC on Base can filter for usdcBase before decoding the full payment requirement.
The fields are identical to the exact scheme.
| Field | Required | Description |
|---|---|---|
scheme | Required | Must be the string 'usdcBase' |
network | Required | Must be 'base' or 'base-sepolia' |
maxAmountRequired | Required | USDC amount in smallest denomination (6 decimals) |
resource | Required | URI of the resource being paid for |
payTo | Required | Recipient USDC wallet address on Base |
// Multi-scheme PAYMENT-REQUIRED
{
"schemes": [
{
"scheme": "usdcBase",
"network": "base",
"maxAmountRequired": "10000",
"resource": "https://api.example.com/api/data",
"payTo": "0xabcdef1234567890abcdef1234567890abcdef12"
},
{
"scheme": "exact",
"network": "base-sepolia",
"maxAmountRequired": "10000",
"resource": "https://api.example.com/api/data",
"payTo": "0xabcdef1234567890abcdef1234567890abcdef12"
}
]
}