š³ Payments
ExtensionFast uses Stripe for payments and Firebase/Supabase for backend processing. This guide walks you through how to set up everything from scratch ā no backend experience required.
š§¾ What Weāll Set Up
- A Stripe product with at least one price to charge users
- A working system to know who paid and who hasnāt
- A Stripe webhook that talks to your backend
undefined
š§Ŗ Stripe Test Mode vs. Live Mode
Stripe provides both a Test Mode and a Live Mode.
- Test Mode: This allows you to simulate payments and webhook events without using real money. Itās crucial for development and testing your integration thoroughly. Youāll use separate test API keys and webhook secrets for this mode.
- Live Mode: This is when youāre ready to accept real payments from your users. Youāll switch to your live API keys and webhook secret.
Itās highly recommended to do all your initial setup and testing using Stripeās Test Mode before switching to Live Mode. This will help you identify and fix any issues without affecting real customers.
You can toggle between Test and Live modes in your Stripe dashboard using the switch in the top left corner.
1. Stripe Setup
First, create a Stripe account at https://stripe.comā.
Once youāre in:
Navigate to the Product Catalog
Once inside your Stripe dashboard or Stripe test dashboard, you can navigate to your Product Catalog on the left-hand sidebar
Create a product
This is what users will pay for (like āExtension - Basicā and/or āExtension - Advancedā).
Create a price for your product
By navigating inside your product, you now have the ability to create a price with the ā+ā sign next to āPricingā.
This defines how much and how often users will pay (one-time or recurring). Make sure to note the price_id
of this price (By clicking on the price after created and scrolling down), you will need it in your application to initiate the checkout.
Grab your API key
Go to the Developers > API keys or Developers > API keys (Test) section.
Copy the key
Copy your Secret key ā youāll need this for Firebase.

2. Firebase Setup
Create a Firebase Project (if you havenāt already)
- Go to Firebase Consoleā and create a new project (or use your existing project).
- Fill out your project name.
- Youāll be prompted for both Gemini and Google Analytics, these arenāt necessary for setup.
Enable Firebase Functions ā this runs backend code.
- From the Firebase console, navigate to Build > Functions
- Click on the button to āUpgrade projectā
- Create a Cloud Billing account
ā ļø Youāll need to add billing information to use functions.
- Donāt worry: Firebase has a very generous free tier that youāll likely stay within unless youāre making significant revenue.
- You can set a budget cap (e.g. $1) in case of emergencies.
Add the Stripe Extension
Firebase makes payments easy with their official Stripe extension.
To add it:
- In the Firebase console, go to Build > Extensions
- Click on āExplore Extensions Hubā
- Search for āRun payments with Stripeā (Made by Invertase)
- Click Install
- Youāll be prompted to enable services, you can enable those to proceed
- When prompted, paste your Stripe Secret key under Stripe API key with restricted access and click āCreate Secretā
- Click Install extension to install the extension
The extension used inside Firebase (Run Payments with Stripe) automatically creates and manages the following Firestore (Firebase database) paths:
-
/products/{productId}
Stores product information from Stripe. Used to list available products for users. -
/products/{productId}/prices/{priceId}
Stores prices for each product. Required for setting up payments or subscriptions. -
/customers/{uid}
Links a Firebase Auth user to a Stripe Customer. Central to managing user billing. -
/customers/{uid}/checkout_sessions/{sessionId}
Used to create and track Stripe Checkout sessions. Triggers Stripe to create a checkout flow. -
/customers/{uid}/subscriptions/{subscriptionId}
Stores subscription data for the user. Helps track active plans and billing status. -
/customers/{uid}/payments/{paymentIntentId}
Logs one-time payments made by the user. Useful for purchase history and receipts.

After itās done installing, Firebase will give you a Webhook URL ā copy this!
3. Create the Webhook in Stripe
Now go back to Stripe to let it talk to your Firebase backend.
Follow the Firebase extension documentation
Once done downloading, navigate to āHow this extension worksā from the left-hand side of the Firebase extension and scroll down until you see āConfigure Stripe webhooksā, follow this guide that the Firebase extension lays out.
Right now, you should be following what the guide says to do, and come back here afterwards.
For the webhooks section, go to the Developers > Webhooks or Developers > Webhooks (Test) section.

4. Add Webhook Secret to Firebase
Go back to Firebase:
Open the Firebase Extension
Click on the Firebase extension, pressing āManageā on the right-hand side of the installed extension.
Navigate to āExtension configurationā and reconfigure
Once inside the Firebase extension, click on the āExtension configurationā on the left-hand sidebar.
Click the āReconfigure extensionā button.
Paste your Webhook Secret
Search for the āStripe webhook secret (Optional)ā, click āShowā, paste your webhook secret, and confirm.
Save and redeploy if prompted
Scroll up and click on the āSaveā button.

5. Firestore Security Rules for āRun Payments with Stripeā Extension
To safely manage user and payment data, itās important to limit access in Firestore. These rules help ensure that:
- Users can only read or write their own data.
- Sensitive Stripe customer data is protected.
- Product and pricing information is publicly accessible.
6. Add these rules to your Firestore rules:
Navigate to your Firebase Firestore
From the console, go to Build > Firestore Database
Go to the āRulesā tab
On the top sidebar, click on the tab that says āRulesā
Replace the Rules
Copy and paste this code block inside of the rules, and āPublishā them for security purposes.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users collection (if you're managing user documents)
match /users/{docId} {
allow create: if request.auth != null && request.auth.uid == request.resource.data.uid;
allow read, update, delete: if request.auth != null && request.auth.uid == resource.data.uid;
}
// Stripe customer data linked to Firebase users
match /customers/{uid} {
allow read: if request.auth.uid == uid;
// Stripe checkout sessions
match /checkout_sessions/{id} {
allow read, write: if request.auth.uid == uid;
}
// Stripe subscriptions
match /subscriptions/{id} {
allow read: if request.auth.uid == uid;
}
// Stripe payments (one-time purchases)
match /payments/{id} {
allow read: if request.auth.uid == uid;
}
}
// Public product catalog from Stripe
match /products/{id} {
allow read: if true;
// Pricing options for each product
match /prices/{id} {
allow read: if true;
}
// Tax rate info if used
match /tax_rates/{id} {
allow read: if true;
}
}
}
}
Checkout Session Redirects
When a payment is successful or unsuccessful after initiating the Stripe checkout session, the user will be redirected to a success/unsuccesful screen, these are already set for your convenience:
- Success - https://extensionfast.com/extension/successā
- Unsuccessful/Cancel - https://extensionfast.com/extension/cancelā
If you would like to change these redirect screens to your own website, there are variables inside info.ts
where you can place your own links.
Thatās it! You now have a full payment pipeline that:
- Lets users pay with Stripe
- Uses Firebase Functions to handle success/fail
- Stores one-time payment info in the Firestore
- Stores subscription payment info in the Firestore
ā Recap Checklist
- Stripe account created
- Product added in Stripe
- Firebase project set up
- Firestore + Functions enabled
- Stripe extension installed in Firebase
- Webhook created in Stripe with Firebase URL
š¬ Additional Resources
- Firestore documentationā ā For more documentation from Firebase
- Stripe documentationā ā For more documentation from Stripe