SDK

Flutter in-app purchases and subscriptions with the RevenueDot SDK

To add in-app purchases to a Flutter app, add the RevenueDot SDK to pubspec.yaml as purchases_flutter from the git tag 10.13.2-revenuedot, then call Purchases.configure with your app's appl_ or goog_ key. RevenueDot checks each purchase with the App Store or Google Play and keeps each customer's access in sync. It runs on iOS, Android and Flutter web. Cloud is free until $10,000 a month.

Free until your app makes $10,000 a month. Switching from RevenueCat? Change one line.

From git

pub.dev names belong to RevenueCat, so purchases_flutter installs from the tag 10.13.2-revenuedot. Imports stay package:purchases_flutter.

iOS, Android and web

One Dart API covers all three. On Flutter web, Test Store keys buy today.

Tested on this tag

A Flutter web build bought a Test Store subscription, and the server showed pro active.

Paywalls

purchases_ui_flutter from the same tag shows paywalls you design in the dashboard.

Steps

How to add subscriptions to a Flutter app with RevenueDot

  1. 01

    Create a free Cloud project

    Start for free on RevenueDot Cloud and add a Test Store app for a first test. Add an App Store app and a Google Play app when you are ready to sell.

  2. 02

    Connect the stores and create the catalog

    Add your store credentials (App Store, Google Play), then products, an entitlement such as pro (the access your app checks) and a current offering (the products your paywall shows).

  3. 03

    Install the RevenueDot SDK and configure it with your key

    Add purchases_flutter from git to pubspec.yaml, run flutter pub get, then call Purchases.configure with the appl_ or goog_ key, as in the code below. On Cloud the SDK already points at RevenueDot, so your key is the only setting.

  4. 04

    Buy and check the entitlement

    Call Purchases.purchase(PurchaseParams.package(package)) and check customerInfo.entitlements.active.containsKey('pro').

  5. 05

    Test with a Test Store key

    Use a test_ key in a debug build and tap Test valid purchase in the dialog. See the Test Store.

Install

Install the RevenueDot Flutter SDK and configure it with your key

The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license), so your code imports package:purchases_flutter and calls Purchases. It sends every request to RevenueDot and needs no RevenueCat account.

Its iOS and Android builds pull RevenueDot's native packages from CocoaPods and Maven Central. Its web bundle is built from RevenueDot's purchases-js 1.67.0.

Self-hosting? Await Purchases.setProxyURL(...) with your server's URL before configure, and leave entitlement verification at its default, disabled, because your server signs with its own key. See Trusted Entitlements.

Install, then configure at app startYAML and Dart
# pubspec.yaml
dependencies:
  purchases_flutter:
    git:
      url: https://github.com/revenuedot/purchases-flutter.git
      ref: 10.13.2-revenuedot
  purchases_ui_flutter:   # only for paywalls
    git:
      url: https://github.com/revenuedot/purchases-flutter.git
      path: purchases_ui_flutter
      ref: 10.13.2-revenuedot

// lib/main.dart
import 'package:flutter/foundation.dart';
import 'package:purchases_flutter/purchases_flutter.dart';

Future<void> initPurchases() async {
  // Flutter web takes a Test Store key; iOS and Android take their store keys.
  final key = kIsWeb ? 'test_...' : defaultTargetPlatform == TargetPlatform.iOS ? 'appl_...' : 'goog_...';
  await Purchases.configure(PurchasesConfiguration(key));
}

Dart

Check the entitlement, then buy a package

Purchases.purchasePackage still works but is deprecated in 10.x.

Check access and buyDart
final customerInfo = await Purchases.getCustomerInfo();
final isPro = customerInfo.entitlements.active.containsKey('pro');

final offerings = await Purchases.getOfferings();
final package = offerings.current?.availablePackages.first;
if (package != null) {
  try {
    final result = await Purchases.purchase(PurchaseParams.package(package));
    final nowPro = result.customerInfo.entitlements.active.containsKey('pro');
  } on PlatformException catch (e) {
    if (PurchasesErrorHelper.getErrorCode(e) != PurchasesErrorCode.purchaseCancelledError) rethrow;
  }
}

Notes

Check these Flutter details before you ship

  • Test Store keys work in debug builds only. Ship with appl_ and goog_ keys.
  • Flutter web buys with Test Store keys today. For real web payments, use a RevenueDot purchase link with Stripe Checkout. See web to app.
  • Status: the Flutter example bought a Test Store subscription on Flutter web, and its iOS simulator builds succeed. It has not run on a device yet.

Switch

Switching from RevenueCat? Keep purchases_flutter and change one line

If your app already ships RevenueCat's purchases_flutter from pub.dev, you can keep it on iOS and Android. Await Purchases.setProxyURL before configure. Verification is already disabled by default. Then call Purchases.syncPurchases() once on the first launch of the update, so current subscribers keep access. The full plan is in Migrate from RevenueCat.

  • Flutter web: the stock package's web plugin ignores setProxyURL, so web calls would still go to RevenueCat. Move to the RevenueDot SDK for web.
  • Keys: the importer keeps your RevenueCat appl_ and goog_ keys working, so builds you already shipped keep their keys.
Point the RevenueCat SDK at RevenueDotDart
import 'dart:io' show Platform;
import 'package:purchases_flutter/purchases_flutter.dart';

Future<void> initPurchases() async {
  await Purchases.setProxyURL("https://api.revenuedot.app");
  await Purchases.configure(
    PurchasesConfiguration(Platform.isIOS ? 'appl_...' : 'goog_...'),
    // entitlementVerificationMode stays at its default, disabled.
  );
  // Once, on the first launch of this update
  await Purchases.syncPurchases();
}

FAQ

Flutter: questions people ask

Do I need a RevenueCat account to use the RevenueDot Flutter SDK?

No. The RevenueDot SDK is built from RevenueCat's open-source Flutter SDK under the MIT license, but every request goes to RevenueDot. Create a free RevenueDot Cloud project, copy your app's keys and pass them to Purchases.configure.

How do I add in-app purchases to a Flutter app?

Add purchases_flutter from the RevenueDot git tag, configure it with your appl_ or goog_ key, fetch offerings and call Purchases.purchase. RevenueDot checks each purchase with the App Store or Google Play and keeps the customer's entitlements in sync.

Why does the RevenueDot Flutter SDK install from git instead of pub.dev?

The pub.dev names purchases_flutter and purchases_ui_flutter belong to RevenueCat. RevenueDot ships the same package names from git tags such as 10.13.2-revenuedot, so your Dart imports stay the same.

Does RevenueDot work with Flutter web?

Yes, with the RevenueDot SDK. Its web bundle is built from RevenueDot's purchases-js, and Test Store keys buy there today. For real web payments, use a RevenueDot purchase link with Stripe Checkout. RevenueCat's stock package ignores the proxy URL on web.

How do I test Flutter purchases without store accounts?

Create a Test Store app, use its test_ key in a debug build and tap Test valid purchase. Test purchases are always sandbox data.

I already ship RevenueCat's purchases_flutter. What changes?

On iOS and Android, await Purchases.setProxyURL("https://api.revenuedot.app") before configure and call syncPurchases once after the update. Verification is already disabled by default. For Flutter web, move to the RevenueDot SDK.

Get started

Start selling subscriptions in your app today.

Building and testing are free, and you can test your first purchase before you have a store account. Pro costs $0 until your apps make $10,000 a month.

Already have an account? Sign in · Switching from RevenueCat? Change one line