Flutter In-App Subscriptions with RevenueCat: Step-by-Step Tutorial
Add iOS and Android subscriptions to a Flutter app with RevenueCat — store setup, entitlements, offerings, a paywall, restoring purchases and testing in sandbox.
On this page
Subscriptions are the most common business model for mobile apps — and one of the fiddliest things to build. You're dealing with two stores, receipt validation, renewals, cancellations, refunds, grace periods and restores.
RevenueCat wraps StoreKit and Google Play Billing behind one SDK and one dashboard, which is why we reach for it on most subscription apps. This tutorial walks through the full setup for a Flutter app.
purchases_flutter docs for exact method signatures on the version you install.##What you'll build
- Two subscription products (monthly and yearly) on both stores
- A RevenueCat entitlement called
prothat unlocks premium features - A paywall that reads products from RevenueCat offerings
- Purchase, restore and "is this user pro?" checks
##1. Create the products in the stores
App Store Connect: open your app, go to Subscriptions, create a subscription group (e.g. "Pro") and add two auto-renewable subscriptions, e.g. pro_monthly and pro_yearly. Fill in pricing, a display name and a review screenshot. Also accept the Paid Apps agreement and add banking and tax details — products won't load without it.
Google Play Console: under Monetize → Subscriptions, create a subscription with base plans for monthly and yearly. Note that you need to upload a build with the billing permission (the RevenueCat SDK adds it) to a testing track before you can create products.
##2. Configure RevenueCat
- 01Create a project and add an App Store app and a Play Store app.
- 02Connect store credentials: an App Store Connect In-App Purchase key, and a Google Play service account with access to financial data. These let RevenueCat validate purchases server-side.
- 03Under Products, import or add
pro_monthlyandpro_yearlyfor both stores. - 04Create an Entitlement named
proand attach all four products to it. - 05Create an Offering (e.g.
default), mark it current, and add two Packages: Monthly and Annual, each mapped to the matching product per store.
Entitlements are the key idea: your app never asks "did the user buy pro_yearly on iOS?" — it asks "does the user have pro?".
##3. Install and configure the SDK
flutter pub add purchases_flutterConfigure it once at startup with the platform-specific public API keys from the RevenueCat dashboard:
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:purchases_flutter/purchases_flutter.dart';
Future<void> initPurchases({String? userId}) async {
if (kDebugMode) await Purchases.setLogLevel(LogLevel.debug);
final apiKey = Platform.isIOS
? 'appl_your_public_ios_key'
: 'goog_your_public_android_key';
final config = PurchasesConfiguration(apiKey)..appUserID = userId;
await Purchases.configure(config);
}If your app has its own accounts, pass your user ID (or call Purchases.logIn(userId) after sign-in) so the subscription follows the user across devices and platforms.
##4. Check whether the user is subscribed
const entitlementId = 'pro';
Future<bool> isPro() async {
final info = await Purchases.getCustomerInfo();
return info.entitlements.active.containsKey(entitlementId);
}To react to renewals, expirations or purchases made on another device, listen for updates:
Purchases.addCustomerInfoUpdateListener((info) {
final pro = info.entitlements.active.containsKey(entitlementId);
// update your state management here (Riverpod, Bloc, ValueNotifier, ...)
});##5. Load the paywall products
Fetch the current offering instead of hardcoding product IDs — this lets you change prices or run experiments from the dashboard without an app update.
Future<List<Package>> loadPackages() async {
final offerings = await Purchases.getOfferings();
return offerings.current?.availablePackages ?? [];
}Each Package has a storeProduct with a localized priceString, title and description — always display the store's localized price, never a hardcoded one.
##6. Make a purchase
import 'package:flutter/services.dart';
Future<bool> buy(Package package) async {
try {
await Purchases.purchasePackage(package);
return isPro();
} on PlatformException catch (e) {
final code = PurchasesErrorHelper.getErrorCode(e);
if (code == PurchasesErrorCode.purchaseCancelledError) {
return false; // user closed the sheet — not an error
}
rethrow; // show a friendly message for real failures
}
}Don't show an error dialog when the user simply cancels. That's one of the most common rough edges in subscription apps.
##7. Restore purchases
Apple requires a visible way to restore previous purchases — usually a "Restore purchases" button on the paywall or in settings.
Future<bool> restore() async {
final info = await Purchases.restorePurchases();
return info.entitlements.active.containsKey(entitlementId);
}##8. Test in sandbox
- iOS: create a Sandbox tester in App Store Connect, or use a StoreKit configuration file for local testing in Xcode. Sandbox subscriptions renew on an accelerated schedule, so you can watch a "month" renew in minutes.
- Android: add license testers in the Play Console and install the app from an internal testing track. Test purchases renew quickly and can be cancelled from the Play Store.
- Watch purchases appear in the RevenueCat dashboard's customer view — it's the fastest way to debug entitlement issues.
##Paywall checklist for App Store review
Subscription apps get extra scrutiny. Before submitting, make sure the paywall:
- Shows the price and billing period clearly, plus any free trial terms
- Links to your Terms of Use and Privacy Policy
- Has a working Restore button
- Unlocks content immediately after purchase
- Uses in-app purchase for digital content (not an external payment link, unless your region and entitlement allow it)
More common rejection causes are in why apps get rejected from the App Store. Next up: add push notifications to your Flutter app to bring subscribers back.
##Frequently asked questions
Do I need RevenueCat for Flutter subscriptions?+
No — you can use the in_app_purchase plugin and validate receipts on your own server. RevenueCat saves you from building and maintaining receipt validation, webhooks and cross-platform entitlement logic.
Why are my products not loading?+
The most common causes are an unsigned Paid Apps agreement on iOS, product IDs that don't match exactly, products not attached to the current offering, or (on Android) testing a build that wasn't installed from a Play testing track.
Can a user subscribe on iOS and use the subscription on Android?+
Yes, if you identify users with your own account system and pass the same app user ID to RevenueCat on both platforms. Anonymous users can't be matched across stores.