HTTP Payment Primitive
Select an example above to see the x402 payment flow in action.
Request Sent
↓
402 Payment Required
↓
Payment Broadcast
↓
Proof Attached
↓
Response Received
Weather API
3 satsGET /api/weather/:city
LLM Summarizer
5 satsPOST /api/summarize
Paid Website
2 satsGET /api/articles/:slug
Data Marketplace
4 satsGET /api/financial/sp500/history
Knowledge Query
3 satsPOST /api/query
Express Middleware
1-10 satsPayment gating middleware
Weather API
3 satsGET /api/weather/:city
LLM Summarizer
5 satsPOST /api/summarize
Paid Website
2 satsGET /api/articles/:slug
Preview free · Full content paid
Data Marketplace
4 satsGET /api/financial/sp500/history
Knowledge Query API
3 satsPOST /api/query
Express Middleware Example
1-10 satsx402Middleware({ price })
const { x402Middleware } = require("./shared/x402-middleware");
// Add to any Express route:
app.get("/api/weather/:city",
x402Middleware({ price: 3, description: "Weather data" }),
weatherHandler
);