Request a priced resource
const url = 'https://example.com/example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/exampleThe first, unpaid call to a priced route is answered with 402 Payment Required and a challenge listing what would satisfy it (each entry a PaymentRequirements). The caller signs an EIP-3009 transferWithAuthorization and retries the same request with an X-PAYMENT header — base64-encoded JSON of the decoded Payment shape (see Settlement for that shape fully expanded). A valid payment yields the resource; an invalid one is challenged again.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Any priced route on the gateway (e.g. an agent proxy path).
Header Parameters
Section titled “Header Parameters”Base64(JSON) of a decoded Payment — x402Version, scheme (v1: exact), network (v1: base), and the signed payload. Absent on the first request; present on the paid retry.
Responses
Section titled “Responses”The resource, returned once a valid X-PAYMENT is presented.
Payment Required — the x402 challenge. accepts lists the acceptable payments, each a PaymentRequirements.
object
One entry of a 402 challenge’s accepts array.
object
Decimal string (256-bit)
Token contract address (hex)
Examplegenerated
{ "x402Version": 1, "accepts": [ { "scheme": "example", "network": "example", "maxAmountRequired": "example", "asset": "example", "payTo": "example", "resource": "example", "maxTimeoutSeconds": 1 } ]}