What is x402?
x402 is an HTTP payment protocol that enables any client to pay any server for access to resources - no API keys, no subscriptions, no signup required.
The name comes from HTTP 402 Payment Required - a status code that was reserved in HTTP/1.1 but never standardized. x402 finally gives it meaning.
How It Works
1. Client requests a resource
2. Server responds with payment requirements
The accepts array lists every chain/asset pair the seller will take. The client picks the one it can pay on.
3. Client builds and signs payment
The client constructs a USDC transfer transaction matching the requirements, signs it with the buyer's wallet, and base64-encodes the result.
4. Client retries with payment header
5. Server settles through the facilitator
The server forwards the payment to the facilitator, which verifies policy compliance, sponsors fees (on Solana), and submits the transaction on-chain. Once confirmed, the server returns the data.
Why x402?
vs. API Keys
| Feature | API Keys | x402 |
|---|---|---|
| Signup required | Yes | No |
| Email verification | Yes | No |
| Rate limits | Complex tiers | Pay for what you use |
| Billing | Monthly invoices | Instant, per-request |
| AI agent friendly | No | Yes |
vs. Traditional Payments
| Feature | Stripe/PayPal | x402 |
|---|---|---|
| Minimum transaction | ~$0.30 fee floor | Fractions of a cent |
| Settlement time | 2-7 days | Seconds |
| Chargebacks | Risk | Impossible |
| Global access | Varies by country | Permissionless |
The Role of the Facilitator
The Facilitator is the middleware that makes x402 practical:
- Verifies payments - Checks transaction validity and policy compliance
- Sponsors fees - Pays transaction fees so buyers don't need native tokens
- Settles on-chain - Signs and broadcasts transactions to the blockchain
Dexter operates the most-used x402 facilitator, settling payments across Solana, Base, Polygon, Arbitrum, Optimism, Avalanche, and SKALE.
Learn more about the Facilitator →
Resources
- x402 Specification - Original Coinbase spec
- Build With x402 - Merchant and developer path
- Facilitator and Chains - Network and settlement details
- Use Dexter - Buyer and agent path