Adding In‑App Purchases with RevenueCat in Flutter
Jun 30, 2025



Summary
Summary
Summary
Summary
RevenueCat streamlines Flutter in-app purchases by abstracting store-specific code for iOS and Android. This guide covers setup, product configuration in app stores, dynamic offerings, purchase implementation, and entitlement updates. Vibe Studio complements this with a no-code platform for building full-stack Flutter apps, enabling fast deployment and seamless backend integration.
RevenueCat streamlines Flutter in-app purchases by abstracting store-specific code for iOS and Android. This guide covers setup, product configuration in app stores, dynamic offerings, purchase implementation, and entitlement updates. Vibe Studio complements this with a no-code platform for building full-stack Flutter apps, enabling fast deployment and seamless backend integration.
RevenueCat streamlines Flutter in-app purchases by abstracting store-specific code for iOS and Android. This guide covers setup, product configuration in app stores, dynamic offerings, purchase implementation, and entitlement updates. Vibe Studio complements this with a no-code platform for building full-stack Flutter apps, enabling fast deployment and seamless backend integration.
RevenueCat streamlines Flutter in-app purchases by abstracting store-specific code for iOS and Android. This guide covers setup, product configuration in app stores, dynamic offerings, purchase implementation, and entitlement updates. Vibe Studio complements this with a no-code platform for building full-stack Flutter apps, enabling fast deployment and seamless backend integration.
Key insights:
Key insights:
Key insights:
Key insights:
Simplified IAP Setup: RevenueCat handles cross-platform store logic with one Dart API.
Dynamic Offerings: Fetch and render purchase options at runtime via the RevenueCat dashboard.
Lifecycle Management: Subscriptions, renewals, and cancellations are tracked through listeners.
Platform Compliance: Easily restore purchases and test flows with sandbox/test accounts.
State Integration: Use providers like Riverpod to reflect subscription state in your UI.
Vibe Studio Advantage: Combine RevenueCat with Vibe Studio for a seamless full-stack Flutter pipeline.
Introduction
Integrating Flutter in app purchases can be complex, especially when handling cross-platform stores and subscription lifecycles. RevenueCat abstracts much of this boilerplate, letting you focus on UI and business logic. In this intermediate tutorial, you’ll learn how to configure RevenueCat in your Flutter project, set up products in App Store Connect and Google Play Console, and implement purchase flows and subscription state management.
Setting up RevenueCat in Flutter
First, add the purchases_flutter package to your pubspec.yaml:
dependencies:
purchases_flutter
Then run flutter pub get. Next, initialize RevenueCat at app startup. Insert your API keys (iOS and Android) in a secure way—environment variables or a secrets manager:
import 'package:purchases_flutter/purchases_flutter.dart';
Future<void> initRevenueCat() async {
await Purchases.setDebugLogsEnabled(true);
await Purchases.setup(
'YOUR_REVENUECAT_API_KEY',
appUserId: null, // or a custom user ID
);
}
Call initRevenueCat() in your main function before runApp().
Configuring Products in App Store and Play Store
Login to App Store Connect and Google Play Console to define in-app products or subscriptions.
• Create consumable or subscription products with unique identifiers (e.g., monthly_premium, one_time_pack).
• Ensure product IDs match exactly in RevenueCat’s dashboard under “Products”.
• Map each store product ID to a RevenueCat offering within the RevenueCat dashboard—this allows you to group products into plans and control promos without shipping new code.
Fetching Offerings and Displaying Options
Offerings let you present different purchase options. Fetch them at runtime and render dynamic UI:
Future<Offerings?> fetchOfferings() async {
try {
final offerings = await Purchases.getOfferings();
return offerings.current;
} catch (e) {
// handle errors
return null;
}
}
In your widget’s initState, call fetchOfferings() and store the result in state. Then loop over current.availablePackages to show price and description for each package.product.
Implementing Purchases in Dart
Once users tap a purchase button, call purchasePackage. It handles both one-time and subscription flows:
Future<void> buyPackage(Package package) async {
try {
final result = await Purchases.purchasePackage(package);
if (result.customerInfo.entitlements.all['premium']?.isActive == true) {
// Grant premium access
}
} on PlatformException catch (e) {
// handle canceled or failed transactions
}
}
Replace 'premium' with your entitlement identifier in RevenueCat. This method returns updated CustomerInfo, letting you verify status immediately.
Handling Subscription State and UI Updates
To react to changes—like renewals, cancellations, or expiry—subscribe to purchaser info updates:
void listenToPurchases() {
Purchases.addCustomerInfoUpdateListener((customerInfo) {
final isActive = customerInfo.entitlements.all['premium']?.isActive ?? false;
// update app state or UI accordingly
});
}
Call listenToPurchases() once after initialization. Use a state management solution (Provider, Riverpod, Bloc) to notify your widgets when access changes.
Restoring Purchases
On iOS, you must offer a “Restore Purchases” button. Call:
await Purchases.restorePurchases();
This fetches past transactions and updates entitlements. On Android, non-consumables and subscriptions are restored automatically but calling this method is safe and consistent.
Testing and Debugging
• Use sandbox/test accounts in App Store Connect and Google Play’s license tester settings.
• Enable verbose logs with Purchases.setDebugLogsEnabled(true) to troubleshoot.
• Simulate subscription renewals and expirations in the App Store sandbox to verify the addCustomerInfoUpdateListener flow.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
By integrating RevenueCat in your Flutter app, you offload tedious store-specific logic—streamlining Flutter in-app purchases and IAP subscription management. You’ve configured products, fetched dynamic offerings, implemented purchase flows, and listened for entitlement updates. This setup scales from simple one-time IAPs to complex subscription tiers, all with minimal platform-specific code.
Introduction
Integrating Flutter in app purchases can be complex, especially when handling cross-platform stores and subscription lifecycles. RevenueCat abstracts much of this boilerplate, letting you focus on UI and business logic. In this intermediate tutorial, you’ll learn how to configure RevenueCat in your Flutter project, set up products in App Store Connect and Google Play Console, and implement purchase flows and subscription state management.
Setting up RevenueCat in Flutter
First, add the purchases_flutter package to your pubspec.yaml:
dependencies:
purchases_flutter
Then run flutter pub get. Next, initialize RevenueCat at app startup. Insert your API keys (iOS and Android) in a secure way—environment variables or a secrets manager:
import 'package:purchases_flutter/purchases_flutter.dart';
Future<void> initRevenueCat() async {
await Purchases.setDebugLogsEnabled(true);
await Purchases.setup(
'YOUR_REVENUECAT_API_KEY',
appUserId: null, // or a custom user ID
);
}
Call initRevenueCat() in your main function before runApp().
Configuring Products in App Store and Play Store
Login to App Store Connect and Google Play Console to define in-app products or subscriptions.
• Create consumable or subscription products with unique identifiers (e.g., monthly_premium, one_time_pack).
• Ensure product IDs match exactly in RevenueCat’s dashboard under “Products”.
• Map each store product ID to a RevenueCat offering within the RevenueCat dashboard—this allows you to group products into plans and control promos without shipping new code.
Fetching Offerings and Displaying Options
Offerings let you present different purchase options. Fetch them at runtime and render dynamic UI:
Future<Offerings?> fetchOfferings() async {
try {
final offerings = await Purchases.getOfferings();
return offerings.current;
} catch (e) {
// handle errors
return null;
}
}
In your widget’s initState, call fetchOfferings() and store the result in state. Then loop over current.availablePackages to show price and description for each package.product.
Implementing Purchases in Dart
Once users tap a purchase button, call purchasePackage. It handles both one-time and subscription flows:
Future<void> buyPackage(Package package) async {
try {
final result = await Purchases.purchasePackage(package);
if (result.customerInfo.entitlements.all['premium']?.isActive == true) {
// Grant premium access
}
} on PlatformException catch (e) {
// handle canceled or failed transactions
}
}
Replace 'premium' with your entitlement identifier in RevenueCat. This method returns updated CustomerInfo, letting you verify status immediately.
Handling Subscription State and UI Updates
To react to changes—like renewals, cancellations, or expiry—subscribe to purchaser info updates:
void listenToPurchases() {
Purchases.addCustomerInfoUpdateListener((customerInfo) {
final isActive = customerInfo.entitlements.all['premium']?.isActive ?? false;
// update app state or UI accordingly
});
}
Call listenToPurchases() once after initialization. Use a state management solution (Provider, Riverpod, Bloc) to notify your widgets when access changes.
Restoring Purchases
On iOS, you must offer a “Restore Purchases” button. Call:
await Purchases.restorePurchases();
This fetches past transactions and updates entitlements. On Android, non-consumables and subscriptions are restored automatically but calling this method is safe and consistent.
Testing and Debugging
• Use sandbox/test accounts in App Store Connect and Google Play’s license tester settings.
• Enable verbose logs with Purchases.setDebugLogsEnabled(true) to troubleshoot.
• Simulate subscription renewals and expirations in the App Store sandbox to verify the addCustomerInfoUpdateListener flow.
Vibe Studio

Vibe Studio, powered by Steve’s advanced AI agents, is a revolutionary no-code, conversational platform that empowers users to quickly and efficiently create full-stack Flutter applications integrated seamlessly with Firebase backend services. Ideal for solo founders, startups, and agile engineering teams, Vibe Studio allows users to visually manage and deploy Flutter apps, greatly accelerating the development process. The intuitive conversational interface simplifies complex development tasks, making app creation accessible even for non-coders.
Conclusion
By integrating RevenueCat in your Flutter app, you offload tedious store-specific logic—streamlining Flutter in-app purchases and IAP subscription management. You’ve configured products, fetched dynamic offerings, implemented purchase flows, and listened for entitlement updates. This setup scales from simple one-time IAPs to complex subscription tiers, all with minimal platform-specific code.
Streamline IAPs with Vibe Studio
Streamline IAPs with Vibe Studio
Streamline IAPs with Vibe Studio
Streamline IAPs with Vibe Studio
Accelerate in-app purchase integration by pairing RevenueCat with Vibe Studio’s no-code Flutter backend and UI generation.
Accelerate in-app purchase integration by pairing RevenueCat with Vibe Studio’s no-code Flutter backend and UI generation.
Accelerate in-app purchase integration by pairing RevenueCat with Vibe Studio’s no-code Flutter backend and UI generation.
Accelerate in-app purchase integration by pairing RevenueCat with Vibe Studio’s no-code Flutter backend and UI generation.
Join a growing community of builders today
Join a growing
community
of builders today
Join a growing
community
of builders today










© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025


© Steve • All Rights Reserved 2025