Overview
The x402 protocol enables HTTP-based payments where services return402 Payment Required responses, clients sign EIP-3009 authorizations, and the Facilitator SDK settles payments on-chain.
Payment Flow
1
Client Requests Resource
2
Server Returns 402
3
Client Signs Authorization
4
Client Submits Payment
5
Facilitator Settles On-Chain
Server verifies signature and settles USDC transfer via Facilitator SDK.
6
Server Grants Entitlement
7
Client Retries with Payment ID
8
Server Returns Content
Implementation
Protecting Routes
Settlement Endpoint
Entitlement Caching
Payments are cached in memory for fast subsequent requests:Security Features
Signature Verification
Signature Verification
All payment headers are verified using EIP-3009 signature recovery before settlement.
Nonce Tracking
Nonce Tracking
Nonces are tracked to prevent replay attacks. Each payment uses a unique nonce.
Expiration
Expiration
Payment authorizations include
validBefore timestamp. Expired payments are rejected.Amount Limits
Amount Limits
maxAmountRequired enforces maximum payment amount. Facilitator rejects overpayments.Network Configuration
| Network | Chain ID | Facilitator URL |
|---|---|---|
| Testnet | 338 | https://facilitator.cronos.org |
| Mainnet | 25 | https://facilitator.cronos.org |