What is x402?
x402 is an open HTTP payment protocol backed by Coinbase, Cloudflare, Google, Visa, Stellar, and Lightning Labs. It enables pay-per-request APIs where clients pay with crypto before accessing a resource. The protocol uses HTTP status code 402 Payment Required — a status code reserved since 1997 for exactly this purpose.How it Works
- Client requests a protected resource
- Server returns 402 with a
PAYMENT-REQUIREDheader containing the price - Client signs a USDC payment using SNIP-12 typed data
- Client retries the request with the signed payment in the
X-PAYMENTheader - Server verifies the signature and settles via Chipi’s gasless paymaster
- Server returns the resource
Why x402 + Chipi?
Chipi’s existing infrastructure maps perfectly to x402:| x402 Concept | Chipi Infrastructure |
|---|---|
| Payment signing | account.signMessage() (SNIP-12) |
| Gasless settlement | PaymasterAdapter / sponsored transactions |
| Automated payments | Session keys (SNIP-9) |
| Client wallets | CHIPI / READY wallets |
- Gasless: Payments are settled through Chipi’s paymaster — users never need STRK for gas
- Session keys: Combined with SNIP-9 sessions, payments happen automatically without user interaction per request
- Native USDC: All payments use native USDC on Starknet mainnet
SDK Support
| Package | What’s Available |
|---|---|
@chipi-stack/types | TypeScript type definitions |
@chipi-stack/core | X402Client — automatic 402 payment handling |
@chipi-stack/backend | X402Facilitator + x402Middleware for Express |
chipi-react | useX402Payment hook |
chipi_sdk (Python) | X402Client + X402Facilitator + middleware |
Quick Examples
Client: Pay for APIs
Server: Monetize APIs
Next Steps
Client Guide
Pay for APIs from your app
Server Guide
Monetize your API endpoints
Session Keys
Automated payments with sessions
