27. x402 Explained
Overview
Section titled “Overview”A short explainer (by Jarrod Watts) on x402, a pattern for making onchain payments a
native part of web requests. It revives the long-dormant HTTP 402 Payment Required status and
wires it to stablecoin payments. Treat this as optional, forward-looking context — useful for
capstone ideas, not a required skill.
Key concepts
Section titled “Key concepts”- The idea — HTTP reserved status code
402 Payment Requireddecades ago but never really used it. x402 puts it to work: a server can respond402with payment details, the client pays onchain (typically a stablecoin), and the request is fulfilled — all in the normal request flow. - Machine-friendly payments — because it’s programmatic and needs no human checkout, it fits API monetization and, notably, AI agents that need to pay for resources autonomously. This is why it’s getting attention now.
- Stablecoins as the rail — payments settle in stablecoins on fast, cheap chains (L2s), so amounts are predictable and fees are small — a fit for micropayments that card networks handle poorly.
- Where it fits an app — pay-per-call APIs, metered access, agent-to-service payments. It’s a different shape from the Token Vendor (Module 3): payment as part of accessing a resource, rather than a standalone buy/sell UI.
- Early but illustrative — the specific standard is new; the transferable lesson is how onchain payments can be embedded directly into ordinary software flows.
Common pitfalls
Section titled “Common pitfalls”- Treating this as a required implementation. It’s context; you’re not expected to build an x402 server here.
- Assuming it needs volatile crypto. The design leans on stablecoins precisely to keep prices predictable.
- Missing the “why now” — the AI-agent angle (autonomous, programmatic payments) is what makes this more than a curiosity.
Check yourself
Section titled “Check yourself”- What HTTP status code does x402 build on, and what does the server return with it?
- Why are stablecoins and L2s a natural fit for this pattern?
- Give one application — human or AI — where pay-per-request onchain payments make sense.
Watch the Video
Section titled “Watch the Video”
x402 Explained
Video credit: Jarrod Watts · Duration: 14 minutes
