Sync Stripe subscription status to your Firebase users
The moment a customer's Stripe subscription changes, we update their Firebase user record so their paid access always matches their real billing status.
This is a deterministic field-mapping sync that keeps a Firebase (Firestore) user record in step with a customer's real Stripe billing state. Use a webhook trigger: run this workflow whenever Stripe reports that a subscription was updated or canceled (the customer.subscription.updated and customer.subscription.deleted events). From the incoming event, read the subscription id and the Stripe customer id.
Call Stripe "Retrieve Subscription" with that subscription id to fetch the authoritative current state: the subscription status, the plan (from the price or product on the subscription's first line item), and the current period end (a Unix timestamp). Always re-retrieve the subscription rather than trusting the numbers in the event payload, so the record reflects the very latest state.
Locate the matching user document with Firebase "Run Firestore Query" against the users collection, filtering where the stored Stripe customer id field equals the customer id from the event. Take the first matching document and note its full document path.
Update that document with Firebase "Update Firestore Document", patching only the billing fields: subscriptionStatus (the Stripe status such as active, past_due, or canceled), plan (the price or product identifier), and currentPeriodEnd (convert the Unix timestamp from Stripe into an RFC3339 timestamp for Firestore). Use an update mask so the rest of the user document is left untouched.
Let me configure the collection that holds users, the field on that document that stores the Stripe customer id used for matching, and the exact field names to write (for example subscriptionStatus, plan, and currentPeriodEnd). If no matching user document is found for the customer, log that and skip rather than creating a new record.
What does this prompt do?
- Watches for subscription changes in Stripe (upgrades, downgrades, renewals, and cancellations) and reacts the moment they happen.
- Finds the matching person in your Firebase (Firestore) database by the Stripe customer id stored on their record.
- Writes the current subscription status, plan, and renewal date onto that user's record.
- Keeps the paid access level in your app accurate without any manual updates or exports.
What do I need to use this?
- A Stripe account with active subscriptions.
- A Firebase project that stores your users in Firestore.
- Each user record needs to store that customer's Stripe customer id so we can match the right person.
How can I customize it?
- Choose which Firestore collection holds your users.
- Set the exact field names to write, for example subscriptionStatus, plan, and currentPeriodEnd.
- Decide which subscription events to act on: updates, cancellations, or both.
FAQs
Do I need to write any code to set this up?
How does it know which user to update?
What happens when a customer cancels?
Will this work with any Stripe plan or price?
How quickly does the record update?
Related templates
Every Monday, turn last week's Stripe payments in every currency into one home currency total and show what was real growth versus exchange rates.
Every weekday morning, check that every Stripe payout actually landed in your Mercury account, and hear about it only when one did not.
When a Stripe payment fails, tag the customer in Keap, log the reason, open a 48 hour follow up task, and send a friendly card update email.
Every new review, listing, or community post gets judged against your house rules, marked approved, held, or blocked, and only the risky ones reach your team.
When a Stripe payment fails, we find the customer in Gladly, log the details, open a follow-up task, and send a warm note to update their payment method.
Every weekday morning, get a short email that totals yesterday's new signups, compares them to your recent average, and flags anything notable.
Stop letting Stripe and Firebase drift out of sync.
Set this up once and every user's paid access in Firebase always reflects their real Stripe billing state.