Reference
x402 primer
How pay-per-call over HTTP works: status 402, payment requirements and the X-PAYMENT header.
HTTP reserved status code 402 Payment Required for decades and never used it. x402 finally does: a server asks for payment, and a client pays in the same HTTP exchange. It is the native checkout for software.
The exchange
- The client sends a normal request.
- The server replies
402with a body describing payment requirements: amount, asset, network, recipient and a short description. - The client builds a signed payment that meets the requirements and resends the request with it in the
X-PAYMENTheader. - The server, usually through a facilitator, verifies the payment, runs the request and settles.
- The response can carry a settlement result header so the client knows the payment went through.
Facilitator
A facilitator is a service that verifies and settles payments for servers, so a seller does not need to run chain infrastructure. Nouspay runs one for Robinhood Chain; self-hosting is planned.
How Nouspay uses it
Nouspay follows this flow, with the network set to Robinhood Chain (eip155:4663) and the asset set to ETH. On top it adds mandates, escrow, splits and receipts.
The ETH payment format is under review; see Payment scheme in ETH.