PAYMENT-REQUIRED header

The PAYMENT-REQUIRED header is where a current x402 endpoint states its price. The protocol's current HTTP transport carries every protocol field in headers rather than in the response body. A client reads the terms from the header value, and the body is left to the server.

The transport specification is explicit that all x402 protocol information is communicated through headers, and it names three: PAYMENT-REQUIRED from the server, PAYMENT-SIGNATURE from the client on the retry, and PAYMENT-RESPONSE after settlement. Response bodies, it says, are a server implementation concern.

The header's value is a base64-encoded PaymentRequired object. Inside it, each entry of the accepts array names one option the endpoint will take: its scheme, its network, the amount, the asset, the receiving payTo address and a maxTimeoutSeconds window.

The field names are not the ones an older tutorial shows, and that is the practical hazard. The earlier transport carried the same information as JSON in the response body, and named the price maxAmountRequired. The current one names it amount and states the network in an identifier form that is not tied to one chain. A client written against one and pointed at an endpoint speaking the other reads a response it cannot parse, which is a mismatch of transports rather than a fault in the endpoint.

→ probe402 records the quote it read at each check — open a tracked endpoint from the endpoint list.

Sources

Related transport · accepts array · payTo · payment challenge

Glossary