School · Module 3 · Lesson 4 of 4
Keep subscription state in sync with Stripe
Your database is a cache. Stripe is the source of truth for status.
Listen for customer.subscription.created/updated/deleted and invoice.paid / invoice.payment_failed. Upsert status, price and current_period_end into one table.
Gate paid features by reading that table, not by trusting a client-held 'isPro' flag.
Use the Customer Portal for plan changes and cancellation so card updates never touch your forms.