How to Add In-App Purchases to React Native

In-app purchases in React Native with RevenueCat. One SDK for iOS and Android. Subscriptions, one-time purchases, entitlement checks. Skip the 28 hours of manual billing code.

Learn/How to Add In-App Purchases to React Native
intermediate2-3 hours (manual) or 15 min (pre-configured)

How to Add In-App Purchases to React Native

In-app purchases in React Native. One SDK, both platforms. Skip 28 hours of manual billing work.

Prerequisites

Apple Developer accountGoogle Play Console accessRevenueCat account

Don't Do It Manually

I tried implementing StoreKit 2 + Google Play Billing directly. 28 hours. Broken edge cases everywhere. Switched to RevenueCat. Working in 2 hours.

Unless you have a specific reason to handle billing yourself, use RevenueCat.

Setup

1. Create RevenueCat Account

Free tier: up to $2,500/month revenue. Enough for most indie apps.

2. Configure Products

In App Store Connect:

  • Create a subscription group
  • Add monthly and annual products
  • Set prices

In Google Play Console:

  • Create a subscription
  • Add base plans

In RevenueCat dashboard:

  • Create a project
  • Connect App Store and Play Store credentials
  • Map products to "Offerings"
  • Create "Entitlements" (what the user gets access to)

3. Install SDK

npx expo install react-native-purchases

4. Initialize

import Purchases from 'react-native-purchases';
import { Platform } from 'react-native';

await Purchases.configure({
  apiKey: Platform.OS === 'ios'
    ? 'appl_your_ios_key'
    : 'goog_your_android_key',
});

5. Show Paywall

const offerings = await Purchases.getOfferings();
const currentOffering = offerings.current;

if (currentOffering) {
  // Display packages: currentOffering.availablePackages
  // Each package has: identifier, product.title, product.priceString
}

6. Make Purchase

try {
  const { customerInfo } = await Purchases.purchasePackage(selectedPackage);
  
  if (customerInfo.entitlements.active['premium']) {
    // User has premium access
  }
} catch (e) {
  if (!e.userCancelled) {
    // Handle error
  }
}

7. Check Entitlements

const customerInfo = await Purchases.getCustomerInfo();
const isPremium = !!customerInfo.entitlements.active['premium'];

Call this on app launch to gate premium features.

Testing

iOS: Use sandbox account in Settings → App Store → Sandbox Account.

Android: Add test email in Google Play Console → License Testing.

Sandbox subscriptions renew every 5 minutes (monthly) or 30 minutes (annual). Makes testing fast.

Common Mistakes

  1. Forgetting to identify the user. Call Purchases.logIn(userId) after auth so purchases are associated with the account.

  2. Not handling restore. Add a "Restore Purchases" button. Apple requires it. RevenueCat makes it one call: Purchases.restorePurchases().

  3. Testing on simulator. Purchases don't work on simulators. Always test on a real device.

Time Comparison

Approach Time Maintenance
Manual (StoreKit + Play Billing) 28-50 hours High
RevenueCat 2-3 hours Low
AI App Factory (pre-configured) 15 minutes None

Related

Or let AI App Factory handle this for you.

Everything in this guide is already pre-configured in AI App Factory. 11 AI agents automate the rest.

AI App FactoryLearnHow to Add In-App Purchases to React Native