Learn
Learn the x402 payment loop
x402 lets an API charge a small payment before it returns data. No account required. Read the loop below, then practice in the app.
Prefer a longer explainer? What is x402?
New here? Start in this order
- 1. What is x402? — the plain-English idea
- 2. Your first Solana wallet — practice safely on Devnet
- 3. The payment loop below — see it step by step
- 4. Try the live lab — watch a payment happen
- 5. Ship an API or test a 402 — build when ready
The payment loop
x402 makes HTTP 402 Payment Required useful: the server returns a machine-readable price; you (or an agent) pay; you retry with proof; the resource unlocks. Five steps.
- 1
You ask for a paid resource
Your app (or an AI agent) does a normal HTTP request — same as loading any API.
Why: No special payment channel. Money rides on the same web request/response loop the internet already uses.
- 2
Server answers 402 Payment Required
Instead of 200 OK or 401 Login, you get 402: 'Pay this amount, on this network, to this address, for this resource.'
Why: HTTP already reserved 402 for payments. x402 finally defines the machine-readable details so software can pay without humans filling forms.
- 3
Client builds a payment
Your wallet signs a payment that matches the requirements — amount, destination, resource.
Why: Only the key holder can authorize spend. Signing proves intent without handing the server your private key.
- 4
Retry the same request with proof
You call the same URL again, this time attaching the payment proof in a header.
Why: One protocol for humans, bots, and agents: request → price → pay → unlock. No account signup required.
- 5
Server verifies / settles, then delivers
The server checks the proof (itself or via a facilitator), settles on-chain if needed, and returns 200 + the goods.
Why: Sellers get paid per call. Buyers only pay when they need the resource. Micropayments become practical on fast, cheap chains like Solana.
Solana wallets in plain English
A wallet is a key pair, not an app-store install. Public address = share to receive. Private key = never share; it is spending power. Ship x402 creates keys only in your browser.
Read the overview, then open the practice wallet in the app.
Devnet vs mainnet
- Learn / Devnet: free practice SOL, airdrops, break things safely.
- Real / Mainnet: real value. Small amounts in-browser; hardware wallet for savings.
Solana Pay turns your address into a QR or solana: link phones can scan.
What to do next
- Open the practice wallet and create a Devnet wallet (write down keys).
- Run the x402 Lab tab. Same five steps as above.
- Ready to build? Use the Ship generator, then check your 402.
- Building for agents? See the agent classroom and curriculum JSON.