Learn
Learn x402 from beginner to advanced
One path from first concepts to agent-safe production. Guides are ordered beginner → intermediate → advanced. Tools sit at the end of each stage.
Full learning path
Follow the order within each tier. Skip ahead only if you already know the earlier material.
Concepts, wallets, and the payment loop — no code required.
- 1What is x402?Plain-English idea: pay-per-request over HTTP 402.
- 2Your first Solana walletPublic vs private keys on Devnet — zero real risk.
- 3What is an RPC?Blockchain reader vs the paywall. Why endpoints need one.
- 4Reading a Solana transactionOpen a transfer on Solscan and understand the fields.
- 5The payment loop (interactive)Live 402 → read tag → dry-run → quiz → free certificate.
Build, test, migrate, and choose the right rails.
- 1Facilitators explainedCDP, PayAI, test facilitator, self-host — when to pick which.
- 2Test an x402 endpointRead the 402 body and fix common setup mistakes.
- 3Ship an x402 API on Solanav2 middleware, CAIP-2 networks, go-live checklist.
- 4x402 v1 vs v2Headers, CAIP-2, resource envelope — avoid breaking testers.
- 5x402 vs Stripe MPPWhen open micropayments win vs session/fiat rails.
- 6The blind-transfer problemWhen someone wants to pay but you have no 402.
Agent wallets, paywall design, and machine-readable surfaces.
- 1Can AI agents spend money?Yes — inside spend limits and allowlists you set.
- 2x402 vs token-gatingServer-side 402 paywall vs on-chain token checks.
- 3Give an agent a wallet safelyCaps, allowlists, dry-run, never the main key.
- 4Why agent-readable mattersllms.txt, curriculum JSON, well-known agent cards.
- 5HTTP 402: 30 years dormantStory of the status code that became agent payments.
The payment loop
x402 makes HTTP 402 Payment Required useful: machine-readable price, pay, retry with proof, unlock. 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. Public = share to receive. Private = never share. Ship x402 creates keys only in your browser.
Devnet vs mainnet
- Learn / Devnet: free practice SOL, break things safely.
- Real / Mainnet: real value. Small amounts in-browser; hardware for savings.