x402 payments for Next.js
Next.js route handlers can return x402 challenges and verify payments like any other HTTP endpoint. The fastest path is the generated template: `paygate init --framework next` scaffolds a working seller with the challenge/verify/settle cycle wired to the ArisPay facilitator.
Scaffold the seller
The generated route handler returns the 402 challenge for unpaid requests and settles paid ones. Deploy it like any Next.js app — Vercel, Railway, or your own infrastructure.
npx paygate init --framework next --wallet 0xYourAddress \ --route /api/paid --price 5 --network base
Or front an existing deployment with the hosted proxy
If you would rather not touch the codebase at all, point the ArisPay hosted proxy at your deployed app: your API stays exactly as it is, and paygate.arispay.app/{your-slug}/* enforces payment in front of it. Zero code, reversible any time.
Pricing guidance
- Price the route, not the app: each handler declares its own integer-cent price, so a free tier and a paid tier are just two routes.
- Server components and static pages stay free; monetize the JSON endpoints agents actually consume.
FAQ
- Does this work on Vercel?
- Yes — the seller is standard route-handler code with outbound HTTPS calls to the facilitator; no long-lived processes or websockets are required.
- Can humans still use the site?
- Yes. Only the routes you gate return 402. Browser-facing pages are unaffected.
Is your service agent-ready?
Run the free readiness scan — it inspects your live endpoint's discoverability, machine-readable contracts, and payment support, then tells you the highest-impact fix.
