Polar + Stripe Kit for Next.js
Add Polar (Merchant of Record) + Stripe payments to any Next.js app in 10 minutes — checkout, signed webhooks, and subscription tiers. Native fetch only, no SDK that breaks on serverless.
Next.js 15 (App Router) · React 19 · TypeScript · Tailwind CSS · zero payment SDKs
Secure checkout via Polar · 30-day money-back guarantee
What you get
Polar hosted checkout
GET /api/checkout?tier=pro creates a real Polar checkout and redirects. Polar is the Merchant of Record — it handles VAT and sales tax for you.
Server-side payment verification
The success page confirms the payment with Polar's API before showing a success message. It never trusts the redirect URL alone.
HMAC-verified webhooks
Signed webhook handlers for Polar (and Stripe). Forged events are rejected before they touch your database.
Subscription tiers in one file
Edit tiers.ts — the pricing page and checkout route both read from it. Add, rename, or reprice plans without touching the UI.
Stripe dunning hook
invoice.payment_failed handler for involuntary-churn recovery. Ready for registered businesses that want to be their own merchant.
Native fetch — zero SDK
No Polar SDK, no Stripe SDK. Built on native fetch and Node's crypto. Sidesteps the fetch failed errors the official SDKs throw on Vercel and Cloudflare.
What's inside the ZIP
- +src/app/api/checkout/route.ts — GET ?tier=pro creates Polar checkout, redirects
- +src/app/api/webhook/polar/route.ts — verified Polar webhook handler
- +src/app/api/webhook/stripe/route.ts — verified Stripe webhook handler
- +src/app/pricing/page.tsx — pricing UI auto-built from tiers.ts
- +src/app/success/page.tsx — server-side payment verification after redirect
- +src/lib/tiers.ts — single source of truth for plans
- +src/lib/polar.ts — native-fetch Polar client (checkout + verify)
- +src/lib/verify.ts — HMAC signature verification (Polar + Stripe)
- +.env.example with placeholders
- +10-minute README
- +Commercial license (use in unlimited of your own products)
Who is it for
- ✓Solo devs shipping a paid Next.js app who don't want to hand-roll billing.
- ✓Developers outside the US (e.g. Turkey) blocked from Stripe — Polar MoR lets you start selling now.
- ✓Anyone who's hit the SDK fetch failed wall on Vercel and wants a clean fix.
Honest note
This is a code kit, not a get-rich product. It saves you the days of plumbing between "I have an app" and "I can take money." You bring the product; this handles the payment layer.
Secure checkout via Polar · Instant download · 30-day money-back guarantee
Also looking for Next.js website templates?