Start free
Docs › SDKs

React Native SDK

appwind-react-native is a native module built on the Appwind Pay iOS and Android SDKs. Its calls follow RevenueCat's react-native-purchases.

Install

  1. Download the package and unzip it into your project.
  2. Install it and the iOS pods:
npm install ./appwind-react-native
cd ios && pod install
  1. iOS 15 or later. Android: minSdkVersion 23 and Kotlin 2.0 or later.
  2. Expo: use a development build (npx expo prebuild, then npx expo run:ios). It doesn't run in Expo Go, because it has native code.

Configure

import { Platform } from "react-native";
import Purchases, { AppwindUI, PAYWALL_RESULT } from "appwind-react-native";

await Purchases.configure({ apiKey: Platform.OS === "ios" ? "appl_…" : "goog_…" });

Check access

const info = await Purchases.getCustomerInfo();
const isPro = !!info.entitlements.active.pro;

Purchases.addCustomerInfoUpdateListener((info) => setPro(!!info.entitlements.active.pro));

Show a paywall

const r = await AppwindUI.presentPaywallIfNeeded({ requiredEntitlementIdentifier: "pro" });
if (r === PAYWALL_RESULT.PURCHASED || r === PAYWALL_RESULT.RESTORED) unlock();

await AppwindUI.presentFlow({ placement: "onboarding" });
await AppwindUI.presentCustomerCenter();

Build your own paywall

const { current } = await Purchases.getOfferings();
try {
  const { customerInfo } = await Purchases.purchasePackage(current!.annual!);
} catch (e: any) {
  if (!e.userCancelled) Alert.alert("Purchase failed", e.message);
}

Each package has a product with title, priceString, price, currencyCode, subscriptionPeriod and introPrice.

Other calls

restorePurchases(), logIn(id), logOut(), setAttributes({...}), setEmail(), setAppsflyerID(), setAdjustID(), showManageSubscriptions(), getAppUserID().

Moving from react-native-purchases

Change the import from react-native-purchases to appwind-react-native and RevenueCatUI to AppwindUI. Most calls keep their names.