Skip to main content
Guide · For founders

In-App Purchases and Subscriptions in Flutter with RevenueCat: A Production Guide

How I set up in-app purchases and subscriptions in Flutter with RevenueCat: store configuration, offerings and entitlements, paywalls, restore purchases, backend sync via webhooks, sandbox testing and the mistakes that cause store rejections.

Afaq Zahir, author

Afaq Zahir

Flutter mobile product engineer

Published Updated 10 min read

On this page
  1. Why use RevenueCat instead of the in_app_purchase plugin?
  2. How do you set up products in App Store Connect and Google Play Console?
  3. How do offerings and entitlements work?
  4. How do you set up purchases_flutter?
  5. How should the paywall flow work?
  6. Why is Restore Purchases required?
  7. How do you sync subscription status to Firestore or your backend?
  8. How do you test purchases in sandbox?
  9. What does Apple guideline 3.1.1 mean for Flutter apps?
  10. What are the most common RevenueCat pitfalls?
  11. Frequently Asked Questions

Quick answer

To add subscriptions to a Flutter app with RevenueCat, create products in App Store Connect and Google Play Console, map them to entitlements and offerings in RevenueCat, install purchases_flutter, configure it at startup with your public SDK keys, show packages from the current offering on a paywall, gate features on active entitlements, add a Restore Purchases button, and sync status to your backend with webhooks.

Key takeaways

  • RevenueCat handles receipt validation, renewals and cross-platform subscription state, which is the hardest part of doing in-app purchases yourself.
  • Gate features on entitlements, never on product IDs, so you can change prices and products without shipping an app update.
  • Apple requires a visible Restore Purchases option, and digital goods sold inside iOS apps must generally use in-app purchase (guideline 3.1.1).
  • Treat the backend as a mirror of RevenueCat: sync entitlement state through webhooks and re-fetch the subscriber instead of trusting the event payload alone.
  • Most purchase bugs show up only in sandbox and review, so test renewals, cancellations and restores on real devices before submitting.

Payments are where a Flutter app stops being a demo and starts being a business, and in-app subscriptions are the part founders most often underestimate. I have shipped RevenueCat purchases in LQDCNVS, a 4K art streaming app for iOS, Android, Android TV and Fire TV, and RevenueCat subscription paywalls alongside Stripe in Omni Connect, a multi-tenant booking platform. This guide is the setup I now use by default, plus the mistakes that cost me time the first time around.

Why use RevenueCat instead of the in_app_purchase plugin?

Use RevenueCat when you sell subscriptions or need purchase state on more than one platform; use the raw in_app_purchase plugin only for simple one-time purchases where you are willing to build receipt validation yourself.

The plugin gives you access to StoreKit and Google Play Billing, but it does not tell you whether a user is subscribed right now. Answering that question reliably means server-side receipt validation, renewal tracking, grace periods, refunds and upgrades, and that is the work RevenueCat does for you.

Concernin_app_purchase (official plugin)RevenueCat (purchases_flutter)
Receipt validationYou build and host itHandled server-side by RevenueCat
Subscription statusYou derive it from receipts and store notificationsExposed as active entitlements in CustomerInfo
Cross-platform accessYou link iOS and Android purchases to accounts yourselfOne customer record across stores when you identify users
Changing products or pricesUsually needs an app updateChange offerings in the dashboard, no release needed
Backend syncImplement App Store Server Notifications and Play RTDNOne webhook format for both stores
CostFree, but engineering time is significantFree tier, then a revenue-based fee (check current pricing)

For an MVP, the trade-off is easy. Building correct subscription validation for two stores can take longer than the rest of a 30-day build. RevenueCat gets you to a working paywall in a day or two, and you can migrate away later because the purchases still live in Apple and Google's systems.

How do you set up products in App Store Connect and Google Play Console?

Create the products in each store first, using matching, descriptive IDs, then import them into RevenueCat. The stores are the source of truth for what can be bought; RevenueCat only references them.

App Store Connect

  • Sign the Paid Apps agreement and complete banking and tax details. Products will not load until this is done, and the error you get is not helpful.
  • Create a subscription group (for example "Pro") and add your monthly and annual subscriptions inside it. Users can only hold one subscription per group, which is what makes upgrades and downgrades work.
  • Fill in the localized display name, description, price and a review screenshot for each product. Missing metadata keeps products in "Missing Metadata" and they will not appear in sandbox.
  • Generate the API credentials RevenueCat asks for in its dashboard so it can validate transactions with Apple.

Google Play Console

  • Upload a build with the billing permission to at least an internal testing track. Play will not let you create or query products for an app it has never seen a billing-enabled build for.
  • Create a subscription, then add base plans (monthly, annual) and optional offers such as free trials.
  • Create a Google Cloud service account with the permissions RevenueCat's docs list and upload its JSON key to RevenueCat. New credentials can take a while before they work, so do this early.

How do offerings and entitlements work?

An entitlement is what the user gets access to ("pro"), and an offering is the set of packages you show on the paywall ("default" with monthly and annual). Your Flutter code should check entitlements and display offerings, and should almost never mention a product ID directly.

In LQDCNVS this separation paid for itself: the app runs on phones and TV devices, and the question every screen asks is simply "does this user have premium access?" Which store product unlocked it does not matter to the UI. Attach every product that grants premium to the same entitlement, and you can add a new annual plan or run a price test without touching the app.

How do you set up purchases_flutter?

Add purchases_flutter, configure it once at startup with the platform-specific public SDK key, and identify the user after they log in. The public SDK keys are designed to ship in the app; your RevenueCat secret API key must never be in the client.

import 'dart:io';
import 'package:purchases_flutter/purchases_flutter.dart';

Future<void> initPurchases() async {
  await Purchases.setLogLevel(LogLevel.info);

  final apiKey = Platform.isIOS
      ? const String.fromEnvironment('RC_IOS_KEY')
      : const String.fromEnvironment('RC_ANDROID_KEY');

  await Purchases.configure(PurchasesConfiguration(apiKey));
}

// Call after your own auth (e.g. Firebase Auth) signs the user in.
Future<void> identifyUser(String uid) async {
  await Purchases.logIn(uid);
}

Future<void> signOutPurchases() async {
  await Purchases.logOut();
}

Using your own user ID (for example the Firebase UID) with logIn is what lets a subscription bought on iPhone unlock the Android TV app, and it is what makes backend sync straightforward. Method names have changed between major versions of the SDK, so check the package changelog for the version you install.

How should the paywall flow work?

Fetch the current offering, render its packages, call purchase, and then read the active entitlement from the returned customer info. Treat user cancellation as a normal outcome, not an error.

import 'package:flutter/services.dart';
import 'package:purchases_flutter/purchases_flutter.dart';

const entitlementId = 'pro';

Future<Offering?> loadOffering() async {
  final offerings = await Purchases.getOfferings();
  return offerings.current; // null if nothing is configured as current
}

Future<bool> buy(Package package) async {
  try {
    final info = await Purchases.purchasePackage(package);
    return info.entitlements.active.containsKey(entitlementId);
  } on PlatformException catch (e) {
    final code = PurchasesErrorHelper.getErrorCode(e);
    if (code == PurchasesErrorCode.purchaseCancelledError) return false;
    rethrow; // surface a real error message to the user
  }
}

Future<bool> isPro() async {
  final info = await Purchases.getCustomerInfo();
  return info.entitlements.active.containsKey(entitlementId);
}

Use package.storeProduct.priceString for prices so users see their local currency and tax-correct amount; never hardcode "$9.99" in the UI. Also listen for changes with Purchases.addCustomerInfoUpdateListener and push the result into your state management (Riverpod, BLoC or GetX all work), so a renewal or expiry updates the UI without a restart. RevenueCat also offers prebuilt paywall UI in a separate package if you would rather not build your own.

Why is Restore Purchases required?

Apple expects apps with restorable purchases, including subscriptions, to give users a way to restore them, and a missing Restore button is one of the most common reasons I see paywalls rejected. Put it on the paywall and in settings.

Future<bool> restore() async {
  final info = await Purchases.restorePurchases();
  return info.entitlements.active.containsKey(entitlementId);
}

Show a clear message when nothing was found ("No active subscription on this Apple ID") instead of failing silently. Reviewers tap this button. For more review traps, see my guide to fixing common App Store rejections.

How do you sync subscription status to Firestore or your backend?

Configure a RevenueCat webhook that points to a Cloud Function or API route, verify the authorization header, then re-fetch the subscriber from RevenueCat's REST API and write the entitlement state to your database. The app reads the SDK for UI gating; the backend uses its own copy for anything it enforces, like API limits or Firestore Security Rules.

Omni Connect combined RevenueCat subscription paywalls with Stripe and kept its data in Firestore, which is exactly the setup where the server needs to know a user's plan independently of the app. A simplified version of the handler pattern:

// Cloud Function (TypeScript), simplified
export const revenuecatWebhook = onRequest(async (req, res) => {
  if (req.get('Authorization') !== `Bearer ${process.env.RC_WEBHOOK_SECRET}`) {
    res.status(401).send('unauthorized');
    return;
  }
  const uid = req.body.event.app_user_id;
  // Re-fetch instead of trusting event order or payload alone.
  const subscriber = await fetchSubscriber(uid); // RevenueCat REST API, secret key
  const pro = subscriber.entitlements?.pro;
  await db.doc(`users/${uid}`).set({
    isPro: !!pro && new Date(pro.expires_date) > new Date(),
    proExpiresAt: pro?.expires_date ?? null,
  }, { merge: true });
  res.status(200).send('ok');
});

Two rules matter here. Webhooks can arrive late, more than once or out of order, so the handler must be idempotent and should derive state from a fresh read. And only the server writes isPro; your Security Rules should block clients from setting it. My Firebase Auth security guide covers the rules side. RevenueCat also has a Firebase integration that can write customer info for you; it is worth evaluating if you are already on Firebase.

How do you test purchases in sandbox?

Test on real devices with sandbox testers on iOS and license testers on Android; simulators and emulators hide too many store behaviours. Both stores shorten subscription periods in test environments, so you can watch renewals and expiry happen within minutes.

  • iOS: create sandbox Apple IDs in App Store Connect and sign in under the device's sandbox account settings. A StoreKit configuration file in Xcode is useful for fast local iteration, but always do a final pass against real sandbox.
  • Android: add testers as license testers in Play Console, install from the internal testing track (not a sideloaded debug build signed with a different key), and use the test cards Google provides.
  • Check the RevenueCat dashboard: sandbox purchases show up there, and the customer timeline is the fastest way to see whether a problem is in the store, the SDK or your code.

Run this checklist before every submission: first purchase, cancel mid-flow, restore on a fresh install, restore on a second device with the same account, expiry after cancellation, and upgrade from monthly to annual.

What does Apple guideline 3.1.1 mean for Flutter apps?

Guideline 3.1.1 says that unlocking digital content or features inside an iOS app must generally go through Apple's in-app purchase. Premium filters, content subscriptions, extra credits and pro features are digital goods; you cannot route them through Stripe on iOS just because Stripe is cheaper.

Physical goods and real-world services are different, and can use a payment processor like Stripe. Across Omni Connect, Penitans and PhotoBy I have used Stripe for payments, and in Omni Connect it sat alongside RevenueCat paywalls, so the line between "what goes through the store" and "what goes through Stripe" has to be drawn per product, not per app. The rules on linking to external payment have been changing by region, so read the current App Store Review Guidelines rather than relying on a blog post (including this one) before you design around an exception.

What are the most common RevenueCat pitfalls?

The most common RevenueCat pitfalls are empty offerings, anonymous users losing purchases, gating features on product IDs, trusting the client for server-enforced features, and forgetting TV and other non-phone platforms. Almost every RevenueCat issue I have debugged falls into one of these five:

  1. Empty offerings. Usually agreements not signed, products missing metadata, the Play build not uploaded to a track, or no offering marked as current.
  2. Anonymous users losing purchases. Buying before login creates an anonymous ID. Decide early whether you require login before purchase or rely on RevenueCat's aliasing when the user later logs in.
  3. Gating on product IDs. Hardcoding pro_monthly breaks the day you add an annual plan.
  4. Trusting the client for server features. If your backend enforces limits, it must use its own synced state, not a flag the app sends.
  5. Forgetting non-phone platforms. LQDCNVS runs on Android TV and Fire TV as well as phones, and TV paywalls need D-pad navigable buttons and their own test pass. Fire TV devices use the Amazon Appstore rather than Google Play, so plan the store setup before you promise TV purchases to a client.

Frequently Asked Questions

Is RevenueCat free for Flutter apps?

RevenueCat has a free tier up to a revenue threshold, then charges a percentage of tracked revenue. The exact numbers change, so check their pricing page. For most early-stage apps, the cost is small compared with the engineering time of building and maintaining receipt validation for two stores yourself.

Can I use Stripe instead of in-app purchases in my Flutter app?

For physical goods and real-world services, yes, and I have done so in several apps. For digital content or features consumed inside an iOS app, Apple's guideline 3.1.1 generally requires in-app purchase. Google Play has similar billing rules. Check the current regional exceptions before relying on external payments.

Do I need a backend to use RevenueCat?

No. The SDK can gate features on its own, which is enough for many apps. You need a backend sync when the server enforces something based on subscription status, such as API quotas, AI usage limits or Firestore Security Rules. In that case, webhooks plus a re-fetch is the reliable pattern.

How long does it take to add subscriptions to a Flutter app?

The code is usually a few days. Store setup, agreements, sandbox testing and review add more time, often around a week in total for a first subscription product. Estimates vary with the number of platforms, paywall design and whether backend sync is needed.

Why does Apple reject apps with subscriptions?

The common reasons are a missing Restore Purchases button, unclear pricing or terms on the paywall, missing links to the privacy policy and terms of use, and selling digital features through an external payment method. Reviewers also reject paywalls that fail to load products in their review environment.

If you are planning a subscription app, or your current purchase flow is losing users or failing review, I can help set it up properly. See my Flutter development service, read the LQDCNVS case study, or get in touch.

Afaq Zahir

Written by

Afaq Zahir

Flutter mobile product engineer with 4+ years shipping 20+ apps to the App Store and Google Play. Led Flutter teams at Metasense and Apptex.

GitHub ↗LinkedIn ↗Last reviewed
Book a call