Skip to main content

PAYMENT-REQUIRED

Response

PAYMENT-REQUIRED is the x402 response header returned alongside HTTP 402 Payment Required. It contains a base64-encoded JSON object describing the payment requirements: accepted schemes, price, currency (USDC), network (Base), and the recipient address.

Description

PAYMENT-REQUIRED is sent by the server when the requested resource requires payment. It is always paired with a 402 status code. The value is a Base64-encoded JSON object containing a schemes array – each scheme specifies a payment method the server accepts.

The most common scheme is exact: a fixed USDC price on the Base blockchain. The client reads PAYMENT-REQUIRED, decodes the base64, selects a supported payment scheme, constructs a signed payment payload, and retries the original request with X-PAYMENT attached.

Clients that do not understand x402 will see a plain 402 response and fail gracefully without needing to know about x402 semantics.

Format

Base64(JSON): {schemes: [{scheme: string, network: string, amount: string, currency: string, address: string}]}

PAYMENT-REQUIRED – wire example
http
HTTP/1.1 402 Payment Required
PAYMENT-REQUIRED: eyJzY2hlbWVzIjpbeyJzY2hlbWUiOiJleGFjdCIsIm5ldHdvcmsiOiJiYXNlIiwiYW1vdW50IjoiMTAwMDAiLCJjdXJyZW5jeSI6IlVTREMiLCJhZGRyZXNzIjoiMHgxMjM0NTY3ODkwYWJjZGVmIn1dfQ==
Content-Type: application/json

{"error":"payment_required","message":"This endpoint costs $0.01 USDC"}

See Also