Enable In-App Purchases with RevenueCat
Made by RevenueCat
Facilitates in-app purchases and subscriptions, controls access to premium content, and syncs purchase information to Firestore.
Como esta extensão funciona
RevenueCat’s app monetization platform empowers developers to confidently deploy in-app purchases and subscriptions, centralize data, and grow revenue. RevenueCat builds and adapts to the ever-changing needs of in-app purchase infrastructure, freeing app businesses to invest their time and resources in growing their product.
Install this extension to use Firebase services as your RevenueCat backend for in-app purchases on Apple App Store, Google Play Store, and Amazon Appstore.
The extension makes in-app purchases and subscriptions, controls access to premium content, and syncs customer purchase information to Firestore using RevenueCat.
This extension can:
- Store purchase lifecycle events (e.g., trial starts, purchases, subscription renewals, billing issues) in Firestore and react to them.
- Store and update information about customers and their purchases in Firestore.
- Update information about customers' entitlements as Firebase Authentication Custom Claims.
You need to create a RevenueCat account or already have one set up to use this extension.
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 new subscription has been purchased via the
initial_purchase event, or whenever a subscription or non-renewing purchase has been cancelled through the
Before installing this extension, set up the following Firebase services in your Firebase project:
- Cloud Firestore to store In-App Purchases & Subscriptions details.
- Follow the steps in the documentation to create a Cloud Firestore database.
- (optional) Firebase Authentication to enable different sign-up options for your users to enable Custom Claims management.
- Enable the sign-in methods in the Firebase console that you want to offer your users.
- Create a RevenueCat Project if you haven't already.
- Set up a Firebase integration in RevenueCat: Go to your project settings, and under "Integrations", click "Add", then "Firebase".
- From the newly created integration, copy your shared secret. You will need this to set up the extension.
- Listening to Firebase Authentication events and setting the RevenueCat app user ID to the Firebase UID.
- Setting the reserved RevenueCat subscriber attribute
$firebaseAppInstanceIdto the Firebase App Instance ID if you want to send events to Google Analytics for Firebase.
This extension uses the following Firebase services which may have associated charges:
- Cloud Firestore
- Cloud Functions
- Cloud Secret Manager
- If you enable events Eventarc fees apply.
This extension also uses the following third-party services:
- RevenueCat (RevenueCat pricing information).
You are responsible for any costs associated with your use of these services.
O que pode ser configurado
- Local do Cloud Functions
- RevenueCat Webhook Events Firestore collection
- Location of the customers collection
- Should custom claims be set in Firebase Auth with the user's active entitlements?
- RevenueCat Firebase Integration Shared Secret
Tipo: Cloud Function
Descrição: Listens for RevenueCat server webhook requests, and store customer information and events in Cloud Firestore.
Como instalar a extensão
Como usar o Console do Firebase
Para instalar e gerenciar extensões, use o Console do Firebase.Instalar usando o console
Como usar a Firebase CLI
Para instalar e gerenciar extensões, também é possível usar a Firebase CLI:
Etapa 1: execute o comando npm (em inglês) a seguir para instalar a CLI ou atualizá-la para a versão mais recente.
npm install -g firebase-toolsNão está funcionando? Consulte a referência da Firebase CLI ou altere suas permissões do npm (em inglês).
Etapa 2: configurar um novo diretório do projeto no Firebase ou acessar um já configurado
Etapa 3: adicionar esta extensão ao seu manifesto de extensões ao ser executada
firebase ext:install revenuecat/firestore-revenuecat-purchases --local --project=projectId_or_alias
Etapa 4 (opcional): testar a extensão localmente usando o Pacote de emuladores do Firebase
Etapa 5: implantar as extensões do seu manifesto ao projeto
firebase deploy --only extensions --project=projectId_or_alias