Payments Preflight · Check 10 of 15

Keep subscription state in sync with Stripe

Treat Stripe as the source of truth for subscription status. Sync it into your database from customer.subscription.* events and read access from that one place.

What it is

Stripe holds the real subscription status. Your app needs a copy so it can gate features, kept up to date from webhooks.

Why it matters

If access is decided in several places, or set once at checkout and never updated, cancellations, upgrades and failed renewals do not reach your app.

How to check

How to fix it

  1. Store the Stripe customer id and subscription id against your user.
  2. On each subscription event, retrieve the subscription and save status, price and current period.
  3. Gate features through one helper such as hasActivePlan(user).

Prompt for your AI coding tool

Paste into Cursor, Claude Code, Lovable or similar. Review the diff before you accept it.

Make Stripe the source of truth for subscription access. Store stripe_customer_id and stripe_subscription_id on the user, handle customer.subscription.created, updated and deleted by retrieving the subscription from the API and saving status, price id and current period, and replace every scattered paid check with one hasActivePlan(user) helper. Show the diff.

Sources

Related checks

All payments checks

Sponsor this page: get in touch.

Get new checks by email

New checks and real leak post-mortems, about once a month. No spam.