DEV Community

Sai
Sai

Posted on

Shipped: x402 Paid Endpoint Starter Kit — Next.js 16 (now free + MIT)

Edit 2026-04-17: This kit is now free + MIT. Source: github.com/cryptomotifs/cipher-x402-mcp. Tip in SOL (cR9KrbsLVJvir5rY9cfY3WeNoxMwUGofzpCoVyobryy) if it saved you time.

Shipped: x402 Paid Endpoint Starter Kit — Next.js 16

After my original x402 paywall walkthrough, the same five questions kept landing in my inbox:

  1. Which version of @x402/next actually works cleanly with the Next.js 16 app router?
  2. Where does the facilitator middleware need to sit so Base mainnet USDC verifies correctly?
  3. Do I need a custom listener to verify the X-PAYMENT header, or does the SDK handle it?
  4. What exact .env variables does a working deploy need?
  5. How do I push this to Vercel without tripping on Node 22 module resolution?

I just packaged the full working answers as a 158 KB starter kit. $15, crypto-direct, no platform middleman.

What's inside the ZIP

  • Complete Next.js 16 starter repo — no placeholders, this is the code I deploy myself
  • Pre-wired middleware.ts for the x402 facilitator on Base mainnet USDC
  • /app/protected/route.ts — the canonical route handler pattern, working end-to-end
  • .env.example with every variable commented so you know which to set and which are optional
  • 7-page styled tutorial PDF of the original article — nice for offline reading
  • deploy.sh + deploy.bat — one-command Vercel deploy

How to buy

Three chains, pick whichever you already hold liquidity on:

Chain Asset Address
Base / Ethereum / Polygon / Arbitrum / Optimism USDC (removed — see repo)
Solana USDC-SPL or SOL cR9KrbsLVJvir5rY9cfY3WeNoxMwUGofzpCoVyobryy
Bitcoin BTC (removed)
  1. Send (free — MIT on GitHub) to any of the above.
  2. Email the TX hash to **** with subject line (retracted) <chain>:<tx-hash> — e.g. (retracted) base:0xabc123....
  3. ZIP delivered to your inbox, usually within minutes. The verifier matches the TX on-chain, confirms receiver + amount + confirmations, then auto-sends the file via Resend.

Why wallet-direct

I started with Gumroad and Payhip. Both require Stripe or PayPal KYC on the seller side and neither offers a native crypto payout that matches what AI-agent buyers or on-chain customers actually hold. If you're building on x402, your checkout should route the same way your runtime does — to a wallet.

Related (free)

Questions? Comment here or email. If you hit a gotcha after buying, I'll update the kit and re-send.


Tagged: #x402 #nextjs #ai #crypto #indiedev

Top comments (0)