Documentation
Webhook sync
Mirror RevenueCat entitlement status into Firestore only when Firestore rules need to protect premium data.
1
Pick the backend example
Firebase Admin backend
examples/revenuecatWebhookFirebaseAdmin.ts
Next.js route style
examples/revenuecatWebhookNextRoute.ts
2
Add backend-only secrets
.env
1REVENUECAT_WEBHOOK_SECRET=...2FIREBASE_PROJECT_ID=...3FIREBASE_CLIENT_EMAIL=...4FIREBASE_PRIVATE_KEY=...Watch out
These values belong on your backend, not inside the mobile app.
3
Verify the event flow
- ✓RevenueCat sends the event to your backend URL.
- ✓Your backend verifies the shared secret.
- ✓Your backend reads
event.app_user_id. - ✓Your backend writes
users/{uid}/entitlements/pro. - ✓Firestore rules allow or block premium data.