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:
Key advantages:
- 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
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
