An interesting implementation you have of this system: Firebase Extensions | Run Subscription Payments with Stripe
Use this extension to create subscriptions for your users using Stripe payment platform and manage access control through Firebase Authentication.
Users can subscribe to your digital products and paid content using Stripe Checkout and manage their subscriptions using Stripe’s customer portal.
This extension syncs customers’ subscription status with your Cloud Firestore and adds custom claims using Firebase authentication for easy access control in your app.