The x402 version 2 402 response
When a resource costs money, an x402 seller answers with HTTP 402 and puts its quote in the PAYMENT-REQUIRED response header. The value is base64 of a UTF-8 JSON object. The response body is free-form and clients should not depend on it.
Headers in the exchange
| Header | Sent by | Carries |
|---|---|---|
PAYMENT-REQUIRED | Seller, on the 402 | The quote: what to pay, to whom, on which network |
PAYMENT-SIGNATURE | Buyer, on the retry | The option it accepted and its signed payment |
PAYMENT-RESPONSE | Seller, on the final response | The settlement result, including the transaction hash |
Version 1 used an X-PAYMENT request header and put the quote in the response body. The endpoint checker reports which version an endpoint speaks.
A decoded quote
This is what https://x402testendpoint.com/t/ok sends, after base64 decoding:
{
"x402Version": 2,
"resource": {
"url": "https://x402testendpoint.com/t/ok",
"description": "What is being sold",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:84532",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"amount": "1000",
"payTo": "0xSellerWalletAddress",
"maxTimeoutSeconds": 60,
"extra": {
"name": "USDC",
"version": "2"
}
}
]
}
Fields
| Field | Meaning |
|---|---|
x402Version | 2 for this format. |
error | Optional. Why the previous payment attempt was rejected. See the error reference. |
resource.url | The URL being paid for. Buyers can compare it with what they requested. |
resource.description | Optional but useful: tells agents and catalogs what is being sold. |
accepts | One or more ways to pay. The buyer picks one it supports. |
accepts[].scheme | How the payment works. exact means a fixed amount. |
accepts[].network | A CAIP-2 identifier, such as eip155:8453 for Base or eip155:84532 for Base Sepolia. |
accepts[].asset | The token contract address. |
accepts[].amount | The price in the token's smallest unit, as a string. USDC has six decimals, so 1000 is 0.001 USDC. |
accepts[].payTo | The seller's receiving address. |
accepts[].maxTimeoutSeconds | How long the buyer's signed payment should stay valid. |
accepts[].extra | Scheme-specific data. For exact on EVM, the token's EIP-712 name and version, which the buyer needs in order to sign. |
extensions | Optional add-ons, such as the Bazaar extension that lets facilitator catalogs index the endpoint. |
Check or decode one
- Paste a header into the header decoder to see what it contains.
- Run the endpoint checker on a URL to validate its quote field by field.
- Fetch a known-good example with
curl -i https://x402testendpoint.com/t/ok.
Field names and the header encoding follow the types and helpers in @x402/core 2.31.