Integrating RevenueCat into a React Native App for In-App Purchases

Monday July 1st 2024 | 6 min read

Integrating RevenueCat into a React Native App for In-App Purchases blog post header image

How can you make money from a mobile app on iOS and Android? One of the most popular strategies for monestising a mobile app is to use 'In-app purchases' (aka iAP) through the Apple App Store and Google Play Store.

In our 10+ years experience in making mobile apps across Android and iOS we've learned its not as simple as turning on the iAP 'switch' and applying pricing to your app, not least there's development effort in supporting iAP across both platforms. This is where RevenueCat comes in - their SDK and backend platform greatly simplify the process of adding in-app purchases and subscriptions to React Native apps and more importantly give the tools to easily experiment and iterate on pricing strategies and approaches to monetisation.

At Add Jam we occassionally develop fully native apps but 90% of the time we use React Native as this allows us to have app parity across iOS and Android therefore in this post we'll walk through integrating RevenueCat with React Native and explore the benefits compared to a native implementation.

Step 1: Setup RevenueCat Account and SDK

First, sign up for a free RevenueCat account. RevenueCat is free up to $2.5k MTR (monthly transaction revenue) which is a generous free tier to get your app off the ground.

Once signed up, create a new project in the RevenueCat dashboard and copy the API key. Next, install the react-native-purchases library in your React Native project using npm or yarn. Finally, initialize the SDK in your app with the API key from your RevenueCat project.

The RevenueCat documentation is great. You can get it setup within 30 minutes.

Step 2: Configure In-App Products

Create your in-app products and subscription plans in the iOS App Store Connect and Google Play Console. Note down the product identifiers. This is where you need to put some thought into your initial pricing strategy (more on that later) and creating the products as you would do with a normal iAP setup.

Add these products to your RevenueCat dashboard under the "Products" tab, making sure to use the same identifiers as in the app stores. Then create entitlements in RevenueCat that represent the content or features users get access to when they purchase, such as a "premium" entitlement for subscribers.

In our instance we have one Entitlement (premium access) and we experimented with a few offerings:

  • One time purchase for a full unlock, priced roughly 2 years of subscribing
  • One year annual subscription at roughly 6 months monthly pricing
  • One month subscription

Step 3: Integrate Purchases

To fetch the available products, use the Purchases.getOfferings() method from the SDK. This returns an object containing the products configured in RevenueCat. When a user selects a product to purchase, call Purchases.purchasePackage(package) to initiate the purchase flow. If successful, this will unlock the associated content for the user.

To check if a user has access to a given entitlement, use Purchases.getCustomerInfo() and check the entitlements.active property.

Yup, it's that simple.

Step 4: Test and Deploy

Test your IAP flow using a sandbox environment with RevenueCat, which lets you simulate purchases without spending real money. Then build and run your app on physical devices to verify everything works as expected. When ready, submit the app for review in App Store Connect and Google Play Console, and publish it once approved.

Benefits of using RevenueCat vs Native IAP

Using RevenueCat for in-app purchases in React Native offers several advantages over implementing them natively:

  • Simplified cross-platform integration - RevenueCat provides one SDK and backend to use for both iOS and Android, so you don't need to write separate native code for each platform.
  • Server-side receipt validation - RevenueCat takes care of verifying the validity of purchase receipts on their servers, reducing complexity in your app and helping protect against fraud.
  • Subscription status tracking - Easily check the status of user subscriptions, expiration dates, etc. without needing to query Apple or Google servers directly.
  • Webhooks for important events - Setup webhooks to get notified whenever subscriptions are renewed, expired, refunded, etc. to enable custom logic in your backend.
  • Reporting and analytics - RevenueCat provides a web dashboard with graphs and metrics for revenue, subscriber numbers, retention and more to help track your app's performance.

Perhaps the biggest benefit of using RevenueCat is the ability to easily experiment with different pricing structures and approaches. Want to test out a new subscription tier or run a promotional discount? With RevenueCat, you can quickly make changes to your in-app products and have them propagate everywhere instantly, without needing to update your app or wait for app store review. You can also use RevenueCat's A/B testing feature to trial different prices, durations, and product copy to optimize your offerings. And the detailed analytics let you see how each variation performs in real-time, so you can compare conversion rates, retention, and revenue to determine the optimal pricing strategy for your app. This flexibility to rapidly iterate and improve your monetization is incredibly valuable, especially for new apps still trying to find product-market fit.

The main downsides are the additional cost (RevenueCat takes a percentage of your sales on top of the Apple/Google iAP cut once you exceed $25000 MTR) and it introduces reliance on a third-party service. But for most apps, the time savings and reduced maintenance burden of using RevenueCat are well worth it compared to managing everything yourself.

Conclusion

We've used RevenueCat in our Property Tracker app on iOS and Android which is a tool to help those hunting for a home to save an annotate property listings from popular online property directories. We've found first hand that using RevenueCat dramatically streamlines the process of adding in-app purchases to a React Native app compared to integrating with the Apple and Google stores directly like we had done previously.

By providing a unified API, platform to manage products, and suite of additional features, RevenueCat lets you focus on building and more importantly selling your app instead of building out iAP infrastructure.

If you're looking to add in-app purchases or subscriptions to your React Native app, definitely consider using RevenueCat to save development time. And if you need any help with implementation, feel free to reach out to us at Add Jam - we're experts in mobile app development and our talented team based in Glasgow would be happy to assist.

Chris Sloey's avatar

Chris Sloey

Co-founder

Recent case studies

Here's a look at some of products we've brought to market recently

One Walk A Day

One Walk A Day

During lockdown we rapidly prototyped a health and wellbeing app using React Native then expanded on the concept and redeveloped using SwiftUI

Come Back Soon Tracker

Come Back Soon Tracker

Save money at Center Parcs with Come Back Soon Tracker. Get alerts if the price of a booking decreases and claim a refund with the Come Back Soon Price Promise.

Attachment Bot

Attachment Bot

Attachment Bot is a desktop app that automates finding, saving, and organizing your email attachments.

Let's work together

Add Jam is your plug in team of web and mobile developers, designers and product managers. We work with you to create, ship and scale digital products that people love.

Hello, let's chat 👋