Add subscriptions and checkout flows with webhook-driven access control.
At a glance
- Checkout flow
- Webhook handling
- Subscription state tracking
- Payment provider keys
- Webhook secret
- Product IDs / price IDs
Quickstart
Add your provider API keys and webhook secret to .env.local (POLAR_ACCESS_TOKEN, POLAR_WEBHOOK_SECRET, etc.).
Create your subscription tiers/prices in your provider dashboard (Polar.sh, Stripe, etc.).
Point webhooks to your app's /api/webhooks/[provider] route and verify signature validation is enabled.
Visit /pricing, select a plan, complete checkout, and verify subscription state updates in the dashboard.
Providers
Pick an option below. Each provider has a short guide so you can implement without digging through docs.
PolarAvailableExpand
Default in the current scaffold. Subscriptions + customer portal with Polar.
StripeComing soonExpand
Industry standard payments. Subscriptions, invoices, coupons, and more.
Lemon SqueezyComing soonExpand
Fast SaaS billing and digital products with a simple setup.
Code
Copy/paste-friendly code blocks. Designed to get you working quickly without digging through long docs.
Keys needed to enable checkout + webhook handling.
# PolarPOLAR_ACCESS_TOKEN="your-polar-access-token"POLAR_WEBHOOK_SECRET="your-webhook-secret"POLAR_SUCCESS_URL="http://localhost:3000/success"NEXT_PUBLIC_STARTER_TIER="your-starter-tier-id"NEXT_PUBLIC_STARTER_SLUG="your-org-slug"Once deployed, you’ll point your provider’s webhook to your /api route.
$ # provider dashboard → set webhook URL$ # verify signature validation is enabled