
Introduction
If youโre building a SaaS or premium mobile app, subscriptions are one of the most reliable monetization models.
But implementing subscriptions correctly is not just about adding a payment button โ it involves:
- Secure validation
- Real-time status updates
- Handling edge cases (expiry, restore, refunds) In this guide, Iโll walk you through how I implemented a production-ready subscription system using FlutterFlow + RevenueCat + Firebase.
๐ฐ Why RevenueCat?
Instead of directly handling App Store / Play Store billing, I used RevenueCat because it simplifies everything.
Key Benefits:
- โ Single integration for both iOS & Android
- โ Handles receipts, validation, and renewals
- โ Real-time subscription status via webhooks
- โ Reduces development complexity ๐ Without RevenueCat, managing subscriptions manually becomes very complex.
๐๏ธ System Architecture (Simple View)
Hereโs how the system works:
FlutterFlow App (Frontend)
โ User interacts with UI (Upgrade, Restore)RevenueCat SDK
โ Handles purchase flowRevenueCat Server
โ Validates transactionsFirebase (Firestore + Cloud Functions)
โ Stores subscription status & triggers updates
๐ Complete Subscription Flow
Hereโs the exact flow I implemented:
1. User Action
User clicks โUpgrade to Premiumโ
2. Purchase Trigger
RevenueCat SDK opens native purchase screen (App Store / Play Store)
3. Payment Processing
Payment handled securely by Apple/Google
RevenueCat validates purchase
4. Webhook Trigger
RevenueCat sends event โ Firebase Cloud Function
5. Firestore Update
User document is updated:
{
"isPremium": true,
"plan": "monthly",
"expiryDate": "timestamp"
}
6. UI Update
- FlutterFlow listens to Firestore
- Premium features unlock instantly ๐งพ Firestore Database Structure To keep things scalable and clean, I used this structure:
๐น users collection
{
"userId": "123",
"isPremium": true,
"plan": "yearly",
"expiryDate": "timestamp"
}
๐น subscriptions collection
{
"planId": "monthly_001",
"price": 9.99,
"duration": "1 month"
}
๐น events collection (VERY IMPORTANT)
{
"userId": "123",
"eventType": "PURCHASE",
"timestamp": "server_time"
}
๐ This helps in:
- Tracking revenue
- Debugging issues
- Analytics โ ๏ธ Handling Edge Cases (Most Developers Miss This) This is where most apps fail โ
1. Expired Subscription
- Check expiryDate regularly
Disable premium access automatically
2. Restore PurchasesAdd Restore button
Sync with RevenueCat
Update Firestore again
3. Cancelled Subscription
- User cancels from App Store
- RevenueCat webhook updates backend
Access removed after expiry
4. RefundsRevenueCat sends refund event
Immediately update user access
๐ Backend Validation (CRITICAL)
Never trust frontend logic โ

Always validate subscription from backend using:
- RevenueCat webhooks
Firebase Cloud Functions
๐ Why?Prevents fake unlock hacks
Ensures real subscription status
Keeps your app secure
โก Performance & Cost Optimization
Hereโs what I optimized:
๐น Avoid Excessive Reads
- Store only required subscription fields
Donโt fetch full history every time
๐น Use Real-Time Listeners SmartlyListen only to user document
Avoid unnecessary listeners
๐น Cache Subscription StatusReduce repeated API calls
๐ฏ UI Best Practices (Conversion Focused)
Subscription UI is not just design โ it impacts revenue ๐ฐ
What worked for me:
- Highlight best plan (yearly)
- Show discount badge (Save 30%)
- Clear CTA: โUpgrade Nowโ
- Add trust elements (secure payment, cancel anytime)
๐ Final Result
After implementing this system:
- โ Smooth and secure purchase flow
- โ Real-time subscription updates
- โ Scalable backend architecture
- โ Reduced bugs and edge case failures
๐ก Final Thoughts
FlutterFlow + RevenueCat is a powerful combination for building subscription-based apps quickly.
But the real difference comes from:
- Proper backend validation
- Clean database design
- Handling real-world edge cases ๐ Thatโs what turns a basic app into a production-ready SaaS product.
Top comments (0)