Import
Definition
Decoded payload of the HTTP 402 PAYMENT-REQUIRED header. Contains the x402 protocol version (2), optional error string, protected resource info, list of acceptable payment requirements, and optional extensions.

Properties

number
required
x402 protocol version (2).
string | null
Optional error message from the server.
ResourceInfo | null
The protected resource.
PaymentRequirements[]
required
The payment offers the server accepts. selectRequirement and payForRequirement pick the exact offer for the wallet’s network.
Record<string, unknown> | null
Optional protocol extensions. encodePaymentHeader copies them into the payment payload.

Example

Source: src/index.ts