Run Payments with Stripe
Made by Stripe
Controls access to paid content by syncing your one-time and recurring payments with Firebase Authentication.
How this extension works
Use this extension as a backend for your Stripe payments.
The extension supports multiple use cases:
- Process one-time payments with Stripe Checkout on the web.
- Create subscriptions for your users and manage access control via Firebase Authentication.
- Process payments & set up payment methods with the mobile payment sheet on Android , iOS , or with React Native.
Subscription payments with Stripe Checkout
Users can sign-up for your digital goods and paid content with Stripe Checkout and manage their subscriptions with the Stripe customer portal.
This extension syncs customers' subscription status with your Cloud Firestore and adds custom claims using Firebase Authentication for convenient access control in your application.
The design for Stripe Checkout and the customer portal can be customized in your Stripe Dashboard branding settings . See this example which is customized to match the Firebase color scheme:
If you're building on the web platform, you can use this extension for any of your payment use cases.
If you're developing native mobile applications and you're selling digital products or services within your app, (e.g. subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use the app store's in-app purchase APIs. See Apple's and Google's guidelines for more information.
You can use the
TypeScript type definitions and high-level convenience APIs for most common operations client
applications would want to implement using the extension.
Use a package manager like NPM to install the above package, and use it in conjunction with the Firebase Web SDK.
This extension emits events, which allows you to listen to and run custom logic at different trigger points during the functioning of the extension. For example you can listen to events when a product has been added via the
event, or whenever a payment has succeeded through the
Before installing this extension, set up the following Firebase services in your Firebase project:
- Cloud Firestore to store customer & subscription details.
- Follow the steps in the documentation to create a Cloud Firestore database.
- Firebase Authentication to enable different sign-up options for your users.
- Enable the sign-in methods in the Firebase console that you want to offer your users.
Then, in the Stripe Dashboard :
- Create a new restricted key with write access for the "Customers", "Checkout Sessions" and "Customer portal" resources, and read-only access for the "Subscriptions" and "Plans" resources.
This extension uses the following Firebase services which may have associated charges:
- Cloud Firestore
- Cloud Functions
- Cloud Secret Manager
- Firebase Authentication
- If you enable events Eventarc fees apply.
This extension also uses the following third-party services:
- Stripe Payments ( pricing information )
- Stripe Billing (when using subscriptions. pricing information )
You are responsible for any costs associated with your use of these services.
Note from Firebase
To install this extension, your Firebase project must be on the Blaze (pay-as-you-go) plan. You will only be charged for the resources you use. Most Firebase services offer a free tier for low-volume use. Learn more about Firebase billing.
Starting August 17 2020, you will be billed a small amount (typically less than $0.10) when you install or reconfigure this extension. See the Cloud Functions for Firebase billing FAQ for a detailed explanation.
What you can configure
- Cloud Functions deployment location
- Products and pricing plans collection
- Customer details and subscriptions collection
- Stripe configuration collection
- Sync new users to Stripe customers and Cloud Firestore
- Automatically delete Stripe customer objects
- Stripe API key with restricted access
- Stripe webhook secret
- Minimum instances for createCheckoutSession function
Description: Creates a Stripe customer object when a new user signs up.
Description: Creates a Checkout session to collect the customer's payment details.
Description: Creates links to the customer portal for the user to manage their payment & subscription details.
Description: Handles Stripe webhook events to keep subscription statuses in sync and update custom claims.
Description: Deletes the Stripe customer object and cancels all their subscriptions when the user is deleted in Firebase Authentication.
Description: Deletes the Stripe customer object and cancels all their subscriptions when the customer doc in Cloud Firestore is deleted.
How to install this extension
Using the Firebase console
To install and manage extensions, you can use the Firebase console.Install using console
Using the Firebase CLI
To install and manage extensions, you can also use the Firebase CLI:
Step 1: Run the following npm command to install the CLI or update to the latest CLI version.
npm install -g firebase-toolsDoesn't work? Take a look at the Firebase CLI reference or change your npm permissions.
Step 2: Set up a new Firebase project directory or navigate to an existing one
Step 3: Add this extension to your extension manifest by running
firebase ext:install stripe/firestore-stripe-payments --local --project=projectId_or_alias
Step 4 (Optional): Test this extension locally with the Firebase Emulator Suite
Step 5: Deploy the extensions in your manifest to your project
firebase deploy --only extensions --project=projectId_or_alias