Stripe Subscriptions and Webhooks: A Reliable Setup

Stripe Subscriptions and Webhooks: A Reliable Setup

Checkout, the customer portal and idempotent webhooks: the pieces that make recurring billing reliable.

Opportunist uses multi-currency Stripe subscriptions. Billing is the part of a SaaS product where bugs cost real money, so the setup needs to be boring and reliable.

Let Stripe host the hard parts

Use Stripe Checkout for sign-up and the Customer Portal for upgrades, card changes and cancellations. You avoid building and securing payment forms, and you get tax, receipts and SCA handling for free.

Webhooks drive your database

Your app learns about subscription changes from webhooks, not from redirects. Handle at least:

  • checkout.session.completed: link the Stripe customer to your user.
  • customer.subscription.updated: store status, plan and current period end.
  • customer.subscription.deleted: downgrade access.
  • invoice.payment_failed: notify the user and show a banner.

Store what you need to gate features

{
  stripeCustomerId: "cus_...",
  plan: "pro",
  status: "active",       // trialing | active | past_due | canceled
  currentPeriodEnd: ISODate("2026-12-01")
}

Idempotent handlers

Stripe may deliver an event more than once and not always in order. Record processed event ids, and when in doubt fetch the latest subscription from Stripe instead of trusting the event payload alone.

Multiple currencies

Create a price per currency for each plan and choose it from the user's region at checkout. Keep the plan identity in your own metadata so features do not depend on currency.

More on this topic

Photography
3D Models
Development
Illustrations
Fashion
Digital Art
Packaging
Motion
Illustrations
Video Production
Photography
3D Models
Development
Illustrations
Fashion