SDK

Expo and React Native in-app purchases with the RevenueDot SDK

To add in-app purchases to a React Native or Expo app, install the RevenueDot SDK from npm under the name react-native-purchases and 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. Expo Go and the web buy with a Test Store key. Cloud is free until $10,000 a month.

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

One npm install

An npm alias installs @revenuedot/react-native-purchases 10.10.2 as react-native-purchases.

Expo Go and web

A test_ key buys in Expo Go and on the web, with no store account.

Tested from npm

Installed into the Expo example and run on the web, it loads offerings, buys through the Test Store and turns pro active.

Paywalls

RevenueDot's react-native-purchases-ui shows paywalls you design in the dashboard.

Steps

How to add subscriptions to a React Native app with RevenueDot

  1. 01

    Create a free Cloud project

    Start for free on RevenueDot Cloud. Add a Test Store app and copy its test_ key. Add an App Store app and a Google Play app when you are ready to sell.

  2. 02

    Connect the stores

    Add the App Store In-App Purchase key and the Google Play service account. See App Store and Google Play.

  3. 03

    Create your catalog

    Add products, an entitlement such as pro (the access your app checks) and a current offering (the products your paywall shows).

  4. 04

    Install the RevenueDot SDK and configure it with your key

    Run the npm install below, then call Purchases.configure at app start with the appl_ or goog_ key for the platform. On Cloud the SDK already points at RevenueDot, so your key is the only setting.

  5. 05

    Buy and check the entitlement

    Call Purchases.purchasePackage(pkg) and read customerInfo.entitlements.active["pro"].

  6. 06

    Test in Expo Go or on the web

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

Install

Install the RevenueDot React Native SDK and configure it with your key

The RevenueDot SDK is built from RevenueCat's open-source SDK (MIT license). The npm alias installs it under the name react-native-purchases, so your code imports that package and calls Purchases. It sends every request to RevenueDot and needs no RevenueCat account.

For real App Store and Google Play purchases, build a development build or a production app, as with any native purchase library. Expo Go and the web run the SDK in browser mode with a test_ key.

Self-hosting? Call 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 startTerminal and TypeScript
npm install react-native-purchases@npm:@revenuedot/react-native-purchases@10.10.2
# Paywalls, optional
npm install react-native-purchases-ui@npm:@revenuedot/react-native-purchases-ui@10.10.2

// App start
import { Platform } from "react-native";
import Purchases from "react-native-purchases";

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

TypeScript

Check the entitlement, then buy a package

Check access and buyTypeScript
const customerInfo = await Purchases.getCustomerInfo();
const isPro = customerInfo.entitlements.active["pro"] !== undefined;

const offerings = await Purchases.getOfferings();
const pkg = offerings.current?.availablePackages[0];
if (pkg) {
  try {
    const { customerInfo: after } = await Purchases.purchasePackage(pkg);
    const nowPro = after.entitlements.active["pro"] !== undefined;
  } catch (e: any) {
    if (!e.userCancelled) throw e;
  }
}

Notes

Check these React Native and Expo details before you ship

  • Expo Go and web: the SDK runs in browser mode and accepts test_ and rcb_ keys. RevenueDot accepts test_ only today.
  • Native builds accept test_ keys in debug builds only. Ship with appl_ and goog_ keys.
  • Status: the Expo example ran on the web against RevenueDot. Native builds of it are not verified yet.

Switch

Switching from RevenueCat? Keep react-native-purchases and change one line

If your app already ships RevenueCat's react-native-purchases, you can keep it. Await Purchases.setProxyURL before configure. Entitlement verification is already DISABLED by default in this SDK, which is what RevenueDot needs. Then call Purchases.syncPurchasesForResult() once on the first launch of the update, so current subscribers keep access. The full plan is in Migrate from RevenueCat.

  • Await it: setProxyURL returns a promise, so await it before configure.
  • Verification: remove any INFORMATIONAL or ENFORCED setting. ENFORCED would fail every request, because RevenueDot cannot sign with RevenueCat's key.
  • Keys: the importer keeps your RevenueCat appl_ and goog_ keys working, so builds you already shipped keep their keys.
Point the RevenueCat SDK at RevenueDotTypeScript
import { Platform } from "react-native";
import Purchases from "react-native-purchases";

await Purchases.setProxyURL("https://api.revenuedot.app");
Purchases.configure({
  apiKey: Platform.OS === "ios" ? "appl_..." : "goog_...",
  // Leave entitlementVerificationMode unset: DISABLED is the React Native default.
});

// Once, on the first launch of this update
await Purchases.syncPurchasesForResult();

FAQ

React Native and Expo: questions people ask

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

No. The RevenueDot SDK is built from RevenueCat's open-source React Native 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 React Native app?

Install the RevenueDot SDK from npm under the name react-native-purchases, configure it with your appl_ or goog_ key, then call getOfferings and purchasePackage. RevenueDot checks each purchase with the store and keeps the customer's entitlements in sync.

Does the RevenueDot SDK work with Expo?

Yes. Expo Go and the web run the SDK in browser mode with a test_ key. For real store purchases you build a development or production app, as with any native purchase library, and use your appl_ and goog_ keys.

Can I test React Native purchases without Apple or Google accounts?

Yes. Create a Test Store app and use its test_ key. In Expo Go or on the web, tap a package and choose Test valid purchase.

Why does the install line say react-native-purchases?

The npm alias installs @revenuedot/react-native-purchases under the name react-native-purchases. Your code imports Purchases from react-native-purchases, and the native builds come from RevenueDot's packages on CocoaPods and Maven Central.

I already use RevenueCat's react-native-purchases. What changes?

Await Purchases.setProxyURL("https://api.revenuedot.app") before configure and call syncPurchasesForResult once after the update. Verification is already DISABLED by default, which is what RevenueDot needs.

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