x402 Payments
Turn any HTTP request into a paid request.
$ curl https://api.example.com/data
← HTTP 402 Payment Required
# payment details in response headers$ curl https://api.example.com/data \
-H "x-payment: signed_payload"
← HTTP 200 OK
# response deliveredTL;DR
Client → server returns 402 → client signs USDC payment → retries with header → facilitator settles on-chain → server responds 200.
What is x402?
x402 lets APIs require payment using HTTP 402.
402 Payment RequiredPioneered by Coinbase, x402 standardizes the flow: the 402 response includes payment requirements in headers. The client signs a USDC payment proof and retries. A facilitator settles on-chain. No accounts. No API keys. No subscriptions.
How it works
Four steps from HTTP request to on-chain settlement:
GET /api/dataHTTP 402 + X-PAYMENT-REQUIREMENTSGET /api/data + X-PAYMENT: <signed>HTTP 200 OK + data
Using x402 with RelAI
RelAI handles the entire payment layer so you don't have to run any blockchain infrastructure.
import { relai } from "@relai-fi/x402"
app.use(relai({
price: "0.001",
wallet: "your-wallet-address"
}))Why this matters
Use cases
Agents autonomously discover, negotiate, and pay for API access. Native support for MCP and WebSocket relay.
Charge per request with zero billing infrastructure. Upload OpenAPI spec, set price, start earning.
Gate any URL — articles, datasets, files — with pay-per-access and no sign-ups required.
Consumers use a single API key; RelAI handles all payment signing and settlement behind the scenes.
Key features
Charge as little as $0.001 per call. No minimums, no percentage cuts.
Solana settles in ~400ms. EVM chains in a few seconds. No 30-day net terms.
Fully open-source and permissionless. No vendor lock-in.
Facilitators cannot move funds outside agreed payment terms. Cryptographic proofs.
Solana, Base, Avalanche, SKALE, Ethereum, Polygon. One protocol.
RelAI sponsors all transaction fees on supported networks.
x402 vs traditional API payments
| Feature | Traditional APIs | x402 |
|---|---|---|
| Account required | Yes | No |
| Minimum payment | $5–50/month | $0.001 |
| Settlement time | 30–90 days | < 2 seconds |
| Chargebacks | Yes | Impossible |
| AI agent support | Limited | Native |
| Global access | Restricted by region | Permissionless |
| Billing infrastructure | Required | Built into HTTP |
| Pay-per-use | Complex setup | Default model |
Supported networks
One protocol, multiple blockchains. All payments settle in USDC.
~400ms settlement. SPL Token USDC.
Coinbase L2. Native home of x402.
Zero gas fees. SKALE Credits model.
Fast finality via 0xGasless.
Higher-value API payments.
Affordable EVM with wide wallet support.
FAQ
HTTP status code 402 (Payment Required). The "x" prefix denotes the protocol extension that standardizes how payments flow over HTTP.
Coinbase. It's open-source with contributions from RelAI, Solana Foundation, Cloudflare, and others.
USDC (USD Coin) stablecoins for price stability with blockchain settlement.
Yes — x402 is built for machine-to-machine payments. Agents discover APIs from 402 responses, sign payments, and access resources without human intervention.
Verification takes 200–400ms. Solana settles in ~400ms, EVM chains in a few seconds.
A service that verifies payment signatures and settles on-chain. RelAI supports PayAI, RelAI, AutoIncentive, Dexter, 0xGasless, and Stripe PayTo.
No. Any HTTP resource can be paywalled — web pages, file downloads, streaming data, or any URL.