Stripe
Wire up Stripe billing — products, prices, and the customer portal.
The pricing page and plan cards are already built. You connect Stripe and update plan CTAs in config.ts.
1. Get your keys
In Stripe Dashboard → Developers → API keys:
# .env
PUBLIC_STRIPE_KEY=pk_live_...
STRIPE_SECRET_KEY=sk_live_... # server-side only, never PUBLIC_
Use pk_test_ / sk_test_ keys during development.
2. Create products and prices
In Stripe, create one product per plan with a recurring monthly price and a recurring annual price. Copy the Payment Link URL for each paid plan.
3. Wire up plan CTAs
// src/config.ts
{
id: "pro",
cta: "Start 14-day trial",
ctaHref: import.meta.env.PUBLIC_STRIPE_PRO_LINK ?? "/signup?plan=pro",
}
Add PUBLIC_STRIPE_PRO_LINK=https://buy.stripe.com/... to .env.
4. Customer portal
Enable the Stripe Customer Portal in Billing → Customer Portal → Activate.
# .env
PUBLIC_STRIPE_PORTAL_URL=https://billing.stripe.com/p/login/...
Use this URL on the “Manage billing” button in the dashboard.
5. Webhooks (recommended)
For subscription lifecycle events (payment failed, cancelled, renewed), set up a webhook endpoint:
https://yourdomain.com/api/webhooks/stripe
Events to listen for:
customer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.payment_failed