x402
Pay-per-use access to APIs, content, and services using the x402 protocol.
x402
x402 is a payment protocol that uses the HTTP 402 "Payment Required" status code to enable instant, programmatic payments over the internet. Bag provides full x402 support as a Merchant of Record, handling compliance, tax, and settlement so you can monetize APIs and content with per-request pricing.
What is x402?
x402 allows APIs, websites, and services to require payment before granting access — without subscriptions, API keys, or manual payment processing.
| Property | Detail |
|---|---|
| Protocol | HTTP 402 "Payment Required" status code |
| Settlement | ~200ms on-chain (USDC) |
| Payment | Stablecoin (USDC) on supported networks |
| Accounts | None required — pay with a wallet |
| Facilitator | x402.org open standard |
How It Works
- Client requests a protected resource (API endpoint, content, data)
- Server returns 402 with payment instructions if no valid payment is included
- Client pays — USDC is sent on-chain
- Payment verified — the x402 facilitator confirms the transaction
- Access granted — the server returns the requested resource
The entire flow happens in a single HTTP request/response cycle from the client's perspective.
Use Cases
API Monetization
Charge per API call without subscriptions:
- Weather API: $0.01/query
- Translation: $0.05/1k characters
- Image recognition: $0.10/image
AI Agent Commerce
AI agents can autonomously discover and pay for services:
- Real-time data lookups
- Compute resources
- Proprietary knowledge bases
Content Micropayments
Monetize individual content:
- News articles: $0.05/article
- Research papers: $1.00/download
- Video content: $0.25/view
On-demand Services
Pay-per-use digital services:
- Cloud compute per second
- Data storage per GB/day
- Email validation: $0.001/email
What Bag Handles
As the Merchant of Record for x402 payments, Bag provides:
- KYT/AML screening on all x402 payments
- Tax calculation and remittance per jurisdiction
- Payment settlement and reconciliation
- Dispute resolution for contested payments
- Compliance with local regulations
You receive clean fiat or USDC payouts with consolidated settlement invoices.
Supported Networks
USDC on Base, Polygon, Ethereum, and Solana.
x402 vs Traditional Payments
| Feature | x402 | Traditional (Cards/Subscriptions) |
|---|---|---|
| Settlement time | ~200ms | 1–3 business days |
| Transaction fees | < $0.01 | 2–3% + $0.30 |
| Minimum payment | $0.0001 | ~$0.50 |
| Chargeback risk | None (blockchain finality) | Yes (60–120 days) |
| Geographic restrictions | None | Many |
| Account required | No | Yes |
| Programmatic access | Native | Complex |
What's next
For a step-by-step integration guide with code, see the Agentic Payments guide.