402 Payment Required status code. It enables programmatic payments between any HTTP client and server without accounts, sessions, or custom authentication.
The payment flow
Step by step
1. Initial request The client makes a standard HTTP request to a protected resource.402 Payment Required and includes payment requirements in the response body:
X-PAYMENT header contains a base64-encoded JSON payload with the payment proof.
5. Verification and settlement
The server forwards the payment to a facilitator, which verifies the signature and settles the transaction on-chain. The facilitator returns a confirmation.
6. Resource delivery
Once the payment is confirmed, the server returns the requested resource with a 200 OK response.
Payment requirements
A payment requirement describes what the server accepts. Key fields:| Field | Description |
|---|---|
scheme | Payment method (e.g., "exact") |
network | Blockchain network (e.g., "solana-devnet", "base-sepolia") |
asset | Token to pay with (e.g., "USDC") |
maxAmountRequired | Maximum payment amount (in smallest unit) |
payTo | Recipient address |
resource | The URL being paid for |
maxTimeoutSeconds | How long the payment proof is valid |
Payment payload
TheX-PAYMENT header contains a base64-encoded JSON object:
| Field | Description |
|---|---|
x402Version | Protocol version (currently 1) |
scheme | Which scheme was used |
network | Which network was used |
payload | Scheme-specific proof (signatures, transaction data) |
Further reading
- Facilitators — How payment verification and settlement works.
- Payment Schemes — The specific payment methods available.