x402 seller server
This app monetizes five routes with the x402 payment protocol:
/protected— gated by theproxy.tsmiddleware (whole-route protection)./api/weather?city=...— gated per-route withwithX402, fixed price (exactscheme, settles only after a successful response), backed by live weather data./api/generate?prompt=...— gated per-route withwithX402, usage-based pricing (uptoscheme: buyer authorizes a max, server charges actual usage viasetSettlementOverrides)./api/insights?topic=...&tier=...— gated per-route withwithX402,exactscheme with a dynamic price:$0.001standard,$0.005premium, chosen per-request from atierquery param./api/ping— gated per-route withwithX402,batch-settlementscheme: many cheap calls accumulate in one payment channel, claimed and settled together by a scheduled job (/api/cron/settle) instead of once per request.
Requesting either one without a valid payment returns an HTTP 402 Payment Required with payment instructions. See the README for how to test the full flow.