By Updated •11 min read

Flutter In-App Purchases with RevenueCat: Setup, Testing, and Restore

FlutterMobile DevelopmentIn-App PurchasesRevenueCatMonetization
3D isometric illustration showing an in-app purchase flow in a mobile application

Introduction

To sell premium digital access in a Flutter mobile app, decide what the customer owns, configure products in each store, and connect the resulting transactions to an entitlement that the app can check. RevenueCat can manage the store connection and subscription state, but your app still needs a clear account model, a usable restore path, and tests for interrupted purchases.

This guide covers a subscription or permanent unlock sold through Apple App Store and Google Play. It uses RevenueCat's current Flutter purchase API as documented in November 2026. Store policies, SDK requirements, and billing programs change, so check the linked primary documentation for your distribution regions before release. The examples are integration patterns, not a claim that this repository runs a checkout against both stores.

If you are still deciding between subscriptions, a one-time unlock, and other models, start with my mobile app revenue model guide. This article starts after that product decision.

Decide Which Payment Flow Applies

Apple's App Review Guidelines generally require in-app purchase to unlock digital features or content in an App Store app. Google's Payments policy generally requires Play Billing for digital goods and app functionality in Play-distributed apps. Both have exceptions and region-specific programs; physical goods and services consumed outside the app follow different rules. Do not choose a payment provider from a blanket rule such as "every digital transaction everywhere must use IAP."

Choose the product type from the benefit the buyer receives:

ProductGood fitAccess rule to implement
ConsumableCredits or items that can be used more than onceRecord the balance and each redemption in an account-backed ledger
Non-consumableA permanent feature unlockGrant the entitlement while the purchase remains valid
Auto-renewing subscriptionOngoing content or service accessFollow the store's current subscription state, including expiration and billing changes
Non-renewing subscriptionAccess for a fixed periodRecord the period and design how the same customer recovers it later

Do not describe a product as categorically refundable or non-refundable. Refund decisions and access revocation depend on store policy, region, and the transaction's actual state. A subscription can be appropriate when you continue to provide value; a one-time unlock may fit a fixed feature better.

Model Access Before Building the Paywall

Create an entitlement such as premium_access in RevenueCat, then attach the relevant iOS and Android store products to it. The entitlement is the app's answer to "may this customer use this feature now?" A product ID is only a store catalog identifier. An offering is a set of packages you present for purchase. RevenueCat's entitlements guide explains that separation.

Plan these boundaries before coding:

  1. Customer identity: Decide whether people can buy anonymously, sign in later, or use the same account across devices. Use a stable App User ID if access must follow your own account. Test account switching and RevenueCat's transfer behavior rather than assuming a store account and app account always match.
  2. Access state: Read CustomerInfo after configuration and after a purchase or restore. Check the named entitlement's active status. Do not unlock premium UI merely because a purchase button returned without an error.
  3. Backend authorization: If a paid feature calls a protected API, the backend needs its own trustworthy access decision. A Flutter boolean or locally stored flag cannot authorize a server request.
  4. Consumables: Keep a transaction-aware balance ledger if users spend credits. A reusable entitlement alone does not represent how many credits remain.

My LaGrub case study shows a different implementation choice: native in_app_purchase with custom backend verification for a recipe and cookbook product. RevenueCat is an alternative to that purchase infrastructure, not a claim about which SDK LaGrub uses. The Flutter backend integration guide goes deeper into the backend boundary.

Configure the Stores and RevenueCat

In App Store Connect, complete the applicable agreements, create your in-app purchase or subscription group, set pricing and localizations, and provide the metadata required for review. In Google Play Console, create the in-app product or subscription with its base plan and offers as needed, and activate what your test track needs. Store catalog propagation can take time; treat an empty product list as a configuration or availability problem to investigate, not a normal empty state to hide.

In RevenueCat, add the iOS and Android apps with their actual bundle/package IDs, connect the required store credentials, import or create the products, attach them to premium_access, and place the products in a current offering. Use each platform's public SDK key in the app. RevenueCat's API key guidance warns against putting secret keys in a client build.

Follow the current RevenueCat Flutter installation guide for SDK and native build requirements. At the time of this update, its prerequisites include Flutter 3.22 or later, Android Kotlin 2.1 or later with compileSdk 35 or later, and an iOS minimum deployment target of 13. Install with:

flutter pub add purchases_flutter

Commit your app's dependency lockfile and review SDK upgrades. Avoid copying a version constraint from an older article. Add purchases_ui_flutter only if you use RevenueCat's paywall or customer-center UI components.

Implement a Small Flutter Purchase Flow

Configure the SDK once, before showing a paywall. Use the public key for the current mobile platform:

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

Future<void> configurePurchases() async {
  final publicKey = Platform.isIOS
      ? 'appl_YOUR_PUBLIC_IOS_KEY'
      : 'goog_YOUR_PUBLIC_ANDROID_KEY';

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

Call configurePurchases() after WidgetsFlutterBinding.ensureInitialized() in your app startup. If customers sign in, connect their app identity to RevenueCat according to its user identity guidance before relying on cross-device access.

Load the current offering and handle a missing catalog explicitly:

Future<List<Package>> loadPackages() async {
  final offerings = await Purchases.getOfferings();
  final packages = offerings.current?.availablePackages ?? <Package>[];

  if (packages.isEmpty) {
    throw StateError('No purchase packages are currently available');
  }

  return packages;
}

In the UI, use package.storeProduct.priceString for the store-localized price. Show a retry or a useful unavailable message if offerings fail. Do not invent a local price or silently display a stale paywall.

When the customer chooses a package, use the current RevenueCat purchase API and inspect the returned entitlement:

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

Future<bool> buyPremium(Package package) async {
  try {
    final result = await Purchases.purchase(
      PurchaseParams.package(package),
    );
    return result.customerInfo.entitlements.all['premium_access']?.isActive
        ?? false;
  } on PlatformException catch (error) {
    final code = PurchasesErrorHelper.getErrorCode(error);
    if (code == PurchasesErrorCode.purchaseCancelledError) {
      return false;
    }
    rethrow;
  }
}

Future<bool> hasPremiumAccess() async {
  final info = await Purchases.getCustomerInfo();
  return info.entitlements.all['premium_access']?.isActive ?? false;
}

Cancellation is a normal user choice; show purchase failures separately. When access changes outside this button, such as a renewal, refund, or purchase on another device, refresh CustomerInfo and update the UI. RevenueCat's customer information guide covers caching and update listeners. A cached state can help render an offline screen, but do not treat it as permanent authority for a protected backend action.

Give Customers a Deliberate Restore Path

Provide a visible Restore Purchases action in the paywall or settings. RevenueCat says restorePurchases() should be user-initiated because the operating system may show a sign-in prompt. Do not run it every time the app opens.

Future<bool> restorePremium() async {
  final info = await Purchases.restorePurchases();
  return info.entitlements.all['premium_access']?.isActive ?? false;
}

Show a clear result when there is nothing to restore and a separate error when the store cannot be reached. Test restoring on a second device and after a sign-in change. Consumables and non-renewing purchases need special account-backed recovery; store transaction history alone does not reliably recreate a spent balance. RevenueCat also documents a Google Billing Client 8 limitation for consumed one-time products with anonymous users, so choose identity and backup behavior before launch.

Synchronize a Protected Backend When Needed

For a server-side premium API, maintain a server-side entitlement view and check it on each protected request. RevenueCat webhooks can notify your backend about purchase lifecycle changes, but they are a Pro plan integration, not a default free feature. If you use them, authenticate each delivery, record the event ID for idempotency, process asynchronously, and fetch the current subscriber state when event order or retries make the payload insufficient. Keep secret API keys on the server.

Do not equate CANCELLATION with immediate access loss: cancellation can mean a subscription will stop renewing while the current paid period remains active. Use the current entitlement state and expiration. If you are building your own verification stack instead, implement store server notifications, transaction verification, and recovery explicitly; RevenueCat is a convenience layer, not the only valid architecture.

Test the Complete Purchase Journey

Use Apple Sandbox accounts on an eligible test device. Apple says you do not need to sign out of your personal Apple Account at the device level for in-app purchase testing; use the sandbox sign-in flow. For Android, register a Google Play license tester and use the Play test payment methods. A generic credit-card number from a web payments tutorial is not a Play Billing test card.

ScenarioExpected behavior to verify
Product missing or not yet availablePaywall explains the problem and does not show a fabricated price
Customer cancels checkoutNo access change and no alarming error message
Successful purchaseNamed entitlement becomes active in CustomerInfo and protected features open
Delayed or pending purchaseApp waits for confirmation and does not unlock early
Subscription expires or is refundedAccess follows the verified current entitlement state
Restore after reinstallSigned-in customer recovers eligible purchases through the restore action
Different app account on same store accountAccess follows the identity and transfer policy you deliberately chose
Network failureApp explains which actions are unavailable and preserves a retry path

Test on both stores, with real devices and the actual release configuration. Sandbox renewal timing and store test tools can change, so use the current Apple and Google test documentation rather than hardcoded timing tables. Before submission, Apple asks that in-app purchases be functional and visible to reviewers. Show the subscription price, period, and renewal terms plainly, and provide working policy links.

Conclusion

  • Model the customer's entitlement and account recovery before designing the paywall.
  • Use store products for billing, RevenueCat offerings for presentation, and CustomerInfo for the app's current access state.
  • Keep backend authorization separate from a client-side unlock flag.
  • Test cancellation, pending payments, restoration, expiration, and account changes on both platforms.

Planning paid features in a Flutter app? I help teams choose the purchase model, connect the app and backend access rules, and test the store flows before release. Book a meeting to review your product.

Share

A related project: LaGrub

A Flutter recipe and cookbook app bringing discovery, saved collections, offline access, and native subscriptions into one mobile product.

Read the case study