Introduction to x402
The HTTP 402 payment model, the x402 headers, and how NODRA uses them.
On this page
HTTP 402 Payment Required
HTTP has reserved status 402 Payment Required since its early days, without saying how payment should work. x402 is an open protocol that fills the gap: a server answers 402 with machine-readable payment requirements, the client pays, and the client repeats the request with proof of payment. No accounts, sessions or API keys are involved.
The three headers
| Header | Direction | Carries |
|---|---|---|
PAYMENT-REQUIRED | Gateway → client, on 402 | The quote: what to pay, where and on which network. |
PAYMENT-SIGNATURE | Client → gateway, on the retry | The client's signed payment for that quote. |
PAYMENT-RESPONSE | Gateway → client, on the paid answer | The receipt: whether the payment settled, and its transaction. |
How NODRA uses x402
| Aspect | NODRA |
|---|---|
| x402 version | 2. The version 1 X-PAYMENT header isn't accepted. |
| Scheme | exact: pay exactly the quoted amount. |
| Network | Solana, named by its CAIP-2 id in each quote. |
| Asset | USDC, named by its mint address in each quote. |
Recipient (payTo) | The API's vault, a program-derived address. The transfer goes to the vault's USDC token account. |
| Fee payer | NODRA. The client's transaction names NODRA's fee payer; NODRA co-signs when it settles. Clients need no SOL. |
| Quote id | Carried in extra.memo and required as the transaction's memo, so each payment names the quote it pays. |
| When payment settles | After the provider answers billably (serve first). See Verification and settlement. |
Why x402 suits agents
- Machine-readable prices: an agent sees the exact cost before deciding.
- No onboarding: a wallet is the only prerequisite.
- Per-call settlement: no balances held with the provider, no invoices.
- Bounded risk: each payment is for one call, for one quoted amount, and expires in seconds.