x402 and ProofRails
x402 lets an HTTP server require payment before it returns a resource. ProofRails uses that exchange as an input to its receipt and evidence engine.
Division of responsibility
| Layer | Responsibility |
|---|---|
| x402 client | Reads the 402 challenge, selects an accepted payment option, signs an authorization and retries the request. |
| ProofRails paid endpoint | Publishes payment requirements and runs the protected action after settlement succeeds. |
| X402Facilitator | Settles the accepted USD₮0 EIP-3009 authorization on Flare. |
| ProofRails engine | Records payment and delivery, hashes the response, creates artifacts, signs the evidence bundle and anchors its hash. |
| Verifier | Checks the bundle and onchain commitment later. |
x402 answers, "How does this HTTP request pay?" ProofRails answers, "What was paid for, what did the endpoint return, and which evidence can both sides retain?"
Hosted Flare flow
- The client sends the API request without a payment header.
- ProofRails returns HTTP 402 and a base64
PAYMENT-REQUIREDheader. - The client validates the offered network, token, recipient, amount and facilitator.
- The client signs the selected EIP-3009 authorization.
- It retries the same method, URL and body with
PAYMENT-SIGNATURE. - ProofRails settles the authorization through X402Facilitator.
- The protected handler returns its normal HTTP response.
- ProofRails hashes that response and persists the payment and receipt.
- The HTTP 200 response includes
PAYMENT-RESPONSEwith the transaction and receipt reference. - The receipt worker produces and anchors the evidence bundle.
Hosted payment tuple
| Field | Value |
|---|---|
| Network | Flare mainnet, CAIP-2 eip155:14 |
| Asset | USD₮0, 6 decimals |
| Validated amount | 1000 base units, equal to 0.001 USD₮0 |
| Scheme | exact with EIP-3009 authorization |
| Paid example | POST /v1/x402/premium/fx-lookup |
Real-value warningA successful hosted x402 request spends real USD₮0 on Flare mainnet and creates an irreversible settlement transaction. The payer also needs FLR only when its execution path pays gas. Validate every field in the 402 challenge before signing.
ProofRails operates an integrated x402 facilitator for its own payment-gated APIs; on Flare, USDT0 settlement uses the ProofRails X402Facilitator contract.