The RevenueCat SDK for React Native and Expo. It wraps StoreKit, Google Play Billing, and RevenueCat Billing to handle purchases and subscriptions.
Docs · Install guide · SDK reference · Sample app · Changelog · Migration guide
| Requirement | Minimum |
|---|---|
| React Native | 0.88 or later |
| Expo SDK | 58 or later |
| iOS (bare React Native) | 15.1 |
| iOS (Expo SDK 58) | 16.4, with Xcode 26.4 |
| Android | 7.0 (API level 24) |
| Android compile SDK | API 35 |
| Kotlin | 2.1.0 |
Install the SDK and the UI package with npm. React Native links the native code automatically.
npm install --save react-native-purchases react-native-purchases-uiIn an Expo project, add expo-dev-client for a development build, then install both packages.
npx expo install expo-dev-client
npx expo install react-native-purchases react-native-purchases-uiIn Expo Go, the SDK runs in Preview API Mode and simulates purchases. Real store purchases need a development build.
Then set up each platform:
- iOS: the SDK installs through Swift Package Manager (SPM) only; CocoaPods isn't supported. SPM needs React Native 0.88 or later and is experimental in React Native. Every React Native library with native iOS code must support it; other native dependencies can stay on CocoaPods (Keeping other pods). To set up your Xcode project, or to move an app from CocoaPods, follow Migrate to Swift Package Manager. RevenueCat autolinks from the npm packages, so don't add its Swift packages in Xcode.
- iOS in Expo apps: SPM needs Expo SDK 58 or later, where Expo's SPM support is a preview. If a native dependency in your app still needs CocoaPods, use version 11 of this SDK (Expo apps).
- iOS: add the In-App Purchase capability in Xcode before you make App Store purchases, including in sandbox. Test Store purchases work without it.
- Android: set the
launchModeof the Activity that starts purchases tostandardorsingleTop. New React Native projects usesingleTask, which can cancel a purchase while the user verifies payment in another app (details).
| Package | What it's for | When you need it |
|---|---|---|
react-native-purchases |
Purchases, entitlements, subscription status | Always |
react-native-purchases-ui |
Paywalls and Customer Center | You show RevenueCat Paywalls or Customer Center |
react-native-purchases-store-galaxy |
Galaxy Store purchases | You sell through the Galaxy Store |
react-native-purchases-admob |
Tracks AdMob ad events in RevenueCat | You show ads with react-native-google-mobile-ads 17 on the New Architecture |
Keep every add-on package on the same version as react-native-purchases.
Before you start, create a RevenueCat project, connect your store or start with the Test Store, and add an entitlement. See the Quickstart.
Configure the SDK once at app launch with the public API key for each platform (the Test Store key while you test). In Expo Go, pass your Test Store API key on both iOS and Android; Apple and Google keys throw an error there, so use them when you test real store purchases in a development build.
import { Platform } from 'react-native';
import { useEffect } from 'react';
import Purchases from 'react-native-purchases';
//...
export default function App() {
useEffect(() => {
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
if (Platform.OS === 'web') {
// Only needed if you're targeting web
Purchases.configure({ apiKey: <public_web_billing_api_key> });
} else if (Platform.OS === 'ios') {
Purchases.configure({ apiKey: <public_apple_api_key> });
} else if (Platform.OS === 'android') {
Purchases.configure({ apiKey: <public_google_api_key> });
}
}, []);
}Check whether the user has an active entitlement before you show a paywall:
try {
const customerInfo = await Purchases.getCustomerInfo();
if(typeof customerInfo.entitlements.active[<my_entitlement_identifier>] !== "undefined") {
// Grant user "pro" access
}
} catch (e) {
// Error fetching purchaser info
}- Paywalls: build single-screen or multi-step paywalls in the dashboard and change them without an app update.
- Customer Center: a self-service screen where users cancel subscriptions and restore purchases, and on iOS request refunds and change plans.
- Placements: serve a different Offering at each paywall location in your app.
- Test Store: make test purchases before you connect the App Store or Google Play.
- In-app currency: read the current Customer's in-app currency balances.
- iOS subscription offers: promotional offers, the offer code redemption sheet, and win-back offers.
- Your own purchase code: set
purchasesAreCompletedByto keep completing purchases with your existing in-app purchase code. - Offline entitlements: the SDK grants entitlements for new App Store, Google Play, and Amazon subscription purchases while RevenueCat's servers are down. It's unavailable when your app completes purchases itself.
- Trusted Entitlements: informational by default on iOS and Android. The SDK checks a signature on entitlement data and reports the result without blocking access, so your app decides how to handle tampered responses.
- Amazon Appstore and Galaxy Store: for Amazon, configure with
useAmazon: trueand add Amazon's.pempublic key. The Galaxy Store needs thereact-native-purchases-store-galaxypackage. - Web purchases: in React Native Web apps, the SDK sells through RevenueCat Billing. Redemption Links unlock a web purchase in your app from a deep link.
- Ad Monetization: report ad impressions, clicks, and revenue next to subscription data. The AdMob adapter tracks AdMob events automatically.
- Install guide: npm and yarn commands, iOS and Android setup, other stores, and React Native Web.
- Expo guide: development builds, Expo Go, and test builds with EAS.
- Configure the SDK: API keys, debug logs, and switching between Test Store and real stores.
- Displaying paywalls: present a paywall with
react-native-purchases-ui. - Testing purchases: Test Store and sandbox testing.
- Migration guide: changes in the current major version.
- Troubleshooting: fixes for build and compile problems.
- SDK reference: every public class and method in
react-native-purchases.
Your agent's training data is likely older than the current version of this SDK. Point it at current sources:
- llms.txt: an index of the docs. Add
.mdto any docs URL for a Markdown version. - RevenueCat MCP server: lets your agent read and change your RevenueCat project configuration.
- AI Toolkit: installs RevenueCat skills and the MCP server in one step.
- Releases: check the latest version before adding the dependency.
- MagicWeather: a React Native app that configures the SDK, builds a custom paywall from the current Offering, checks subscription status, restores purchases, and logs users in and out.
- Bugs: open an issue in this repo.
- Account or configuration questions: RevenueCat Support.
- Discussion: RevenueCat Community.
This repository is published from the main branch and release tags of RevenueCat's internal development repository. Issues are tracked here. Pull requests are welcome: a maintainer reviews them here and brings accepted changes into the internal repository, so they can't be merged directly.
See the contributing guide.
MIT. See LICENSE.