What this thread does
Do first: model each selectable plan as its own Product, with Prices for billing variants of that plan. Stripe billing reference
Short answer
Pair Billing APIs with Checkout and the Customer Portal. Update the application through subscription lifecycle webhooks, rather than the Checkout success page. Billing reference Enforce access and record ownership on the server. OWASP
Choose / don't choose
- Checkout and Customer Portal: choose for subscription signup and self-service management; don't implement renewal loops with raw PaymentIntents. Billing reference
- Webhook state: choose for asynchronous changes; don't assume delivery order or process repeated events again. Webhooks
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
Checkout mode | subscription | Subscription signup | Billing reference |
| Lifecycle events | customer.subscription.*, invoice.paid, invoice.payment_failed | Subscription state handler | Billing reference |
| Signature input | Unmodified raw request body and endpoint signing secret | Webhook validation | Webhooks |
| Duplicate key | Processed event ID; separate duplicate events can require object ID plus event type | Webhook handling | Webhooks |
Order of operations
1. Configure plan Products and Prices, then create subscription-mode Checkout Sessions and offer Customer Portal management. Billing reference 2. Check ownership and permissions for billing operations in trusted server code. OWASP 3. Validate webhook signatures before acting; queue processing and return a successful 2xx promptly. Track processed events. Webhooks 4. Handle lifecycle events and the risk events charge.dispute.created, charge.refunded and radar.early_fraud_warning.created. Billing reference 5. Preview prorations before applying subscription changes. Prorations
Known failures and fixes
| Symptom | Cause | Fix | Source |
|---|---|---|---|
| Signature validation fails | Framework changed the body | Validate the raw body | Webhooks |
| Duplicate processing | Same event delivered again | Skip processed event IDs | Webhooks |
| App misses renewals or cancellations | Only success page updates state | Handle subscription lifecycle events | Billing reference |
| Unexpected credit for unpaid time | Proration assumes earlier invoices will be paid | For an unpaid latest invoice, consider proration_behavior=none and reconcile the unpaid invoice | Prorations |
Missing
- What local schema, transaction and recovery policy should keep subscription state consistent? These sources do not supply a Next.js database implementation.
- What should this product grant after a payment failure, refund or dispute? Event handling alone does not define that entitlement policy.
- Tax setup needs its own jurisdiction and registration decisions; the billing reference calls for tax planning alongside the catalog, not an assumption that enabling a flag is sufficient.
Checked
2026-11-23: read Stripe billing reference, Stripe webhooks, Stripe prorations, and OWASP access control.
Started from a post by @WhatWorks editors, packaged by the editor.