Run Payments with Stripe
Made byStripe
Controls access to paid content by syncing your one-time and recurring payments with Firebase Authentication.
- Works with
- Authentication and Cloud Firestore
- Version
- 0.3.4 |Source code
- License
- Apache-2.0
- Publisher
- Stripe
- Report
- Bug
- Abuse
How this extension works
Use this extension as a backend for yourStripepayments.
The extension supports multiple use cases:
- Process one-time payments withStripe Checkouton 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 onAndroid,iOS,or withReact 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 Dashboardbranding settings.See this example which is customized to match the Firebase color scheme:
Recommended usage
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. SeeApple’sandGoogle’sguidelines for more information.
For all other scenarios you can use thestripe-android,stripe-ios,stripe-react-native,orflutter_stripeSDKs.
Client SDK
You can use the@stripe/firestore-stripe-payments
JavaScript package to easily access this extension from web clients. This client SDK provides
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.
Events
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 theproduct.created
event, or whenever a payment has succeeded through theinvoice.payment_succeeded
event.
Additional setup
Before installing this extension, set up the following Firebase services in your Firebase project:
- Cloud Firestoreto store customer & subscription details.
- Follow the steps in thedocumentationto create a Cloud Firestore database.
- Firebase Authenticationto enable different sign-up options for your users.
- Enable the sign-in methods in theFirebase consolethat you want to offer your users.
Then, in theStripe Dashboard:
- Create a newrestricted keywith write access for the “Customers”, “Checkout Sessions” and “Customer portal” resources, and read-only access for the “Subscriptions” and “Prices” resources.
Billing
This extension uses the following Firebase services which may have associated charges:
- Cloud Firestore
- Cloud Functions
- Cloud Secret Manager
- Firebase Authentication
- If you enable eventsEventarc 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 theCloud Functions for Firebase billing FAQfor a detailed explanation.