Start free
Docs › SDKs

Flutter SDK

appwind_purchases is a Flutter plugin built on the Appwind Pay iOS and Android SDKs. Its calls and shapes follow RevenueCat's purchases_flutter, so moving an app is mostly an import swap.

Install

  1. Download the plugin and unzip it next to your app.
  2. Add it to pubspec.yaml:
dependencies:
  appwind_purchases:
    path: ./appwind_purchases
  1. iOS: set platform :ios, '15.0' in ios/Podfile, then run cd ios && pod install.
  2. Android: minSdk 23 and Kotlin 2.0 or later in your app.

Configure

Use the iOS key (appl_…) on iOS and the Android key (goog_…) on Android. Both are in Project → Apps.

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

await Purchases.configure(PurchasesConfiguration(Platform.isIOS ? 'appl_…' : 'goog_…'));

Pass appUserID: if your app has its own accounts, or call Purchases.logIn(id) after sign-in.

Check access

final info = await Purchases.getCustomerInfo();
final isPro = info.entitlements.active.containsKey('pro');

Purchases.addCustomerInfoUpdateListener((info) {
  // purchases, renewals, refunds and logIn all land here
});

Show a paywall

Paywalls designed in the dashboard open natively, full screen:

final result = await AppwindUI.presentPaywallIfNeeded('pro');   // only when the user doesn't have "pro"
// PaywallResult.purchased, .restored, .cancelled, .notPresented, .error
await AppwindUI.presentFlow(placement: 'onboarding');             // an onboarding flow
await AppwindUI.presentCustomerCenter();                          // manage subscription

Build your own paywall

final offerings = await Purchases.getOfferings();
final pkg = offerings.current?.annual;
try {
  final r = await Purchases.purchasePackage(pkg!);
  if (r.customerInfo.entitlements.active.containsKey('pro')) { /* unlock */ }
} on PurchasesException catch (e) {
  if (!e.userCancelled) showError(e.message);
}

Each Package has a storeProduct with title, priceString, price, currencyCode, subscriptionPeriod (ISO 8601, e.g. P1Y) and introductoryPrice.

Other calls

Call What it does
Purchases.restorePurchases() Restore button
Purchases.logIn(id) / logOut() Your own accounts
Purchases.setAttributes({...}) Customer attributes; also setEmail, setAppsflyerID, setAdjustID, setFirebaseAppInstanceID
Purchases.showManageSubscriptions() The store's subscription page
Purchases.customerInfoStream A stream of customer info

Moving from purchases_flutter

Replace package:purchases_flutter/purchases_flutter.dart with package:appwind_purchases/appwind_purchases.dart, and RevenueCatUI.presentPaywallIfNeeded with AppwindUI.presentPaywallIfNeeded. Your entitlements, offerings and app user IDs stay the same after you import your customers.