AccueilClientsExpertisesEstimateursOpen SourceBlogContact

18 mars 2025

RevenueCat x Expo: A Turnkey Solution for Payments and Subscriptions

5 minutes de lecture

RevenueCat x Expo: A Turnkey Solution for Payments and Subscriptions
🇫🇷 This post is also available in french

The subscription and in-app purchase monetization model has become essential in mobile app development. However, implementing it can be complex due to platform differences (iOS and Android) and store regulations.

Simplifying and unifying payment management for developers is the promise of RevenueCat. At Premier Octet, we recently integrated this platform into one of our Expo projects, Photobooth AI, giving us the opportunity to explore its capabilities.

A Seamless Paywall Setup

RevenueCat allows you to design and integrate a paywall directly into your application with just a few lines of code using its SDK. Here are the necessary steps:

Step 1 - Account and Product Setup

Start by creating an account on RevenueCat and linking your apps (Android / iOS / Stripe) to the platform.

Home RevenueCat

Once connected, you can import the products you want to use on the paywall from the Product Catalog / Products tab.

⚠️ The products you wish to sell must first be created in the Apple and Google stores before being imported into RevenueCat.

You have two options:

  • Automatic import: RevenueCat retrieves all available products from your stores.
  • Manual import: You manually add products by entering their identifiers.

Once imported, you can assign display names to your products for better readability. You can also group similar products (e.g., 20 iOS credits and 20 Android credits) and experiment with different offers by combining them using Offerings.

Step 2 - Creating the Paywall

RevenueCat offers a full-featured paywall editor, integrating a library of components (text, images, buttons, and layouts) to design a page that matches your app’s branding.

Paywall Editor

⚠️ Version 2 of the editor, launched in late January, is still in beta. During our implementation, a bug (now fixed) prevented the custom design from displaying on Android, forcing the default design. If deploying a paywall in production, stay vigilant as adjustments may still be necessary.

If your app is multilingual, the editor includes a translation manager supporting the 39 locales of the App Store, allowing you to localize your paywall effortlessly.

Localisation

ℹ️ RevenueCat automatically uses the device language, with no option to modify it using other user preferences from your app. However, a default language can be set from the paywall editor.

Step 3 - Integrating the RevenueCat SDK into Our Expo App

To retrieve products and integrate the paywall design into our Expo app, we use RevenueCat’s react-native-purchases and react-native-purchases-ui libraries.

  npx expo install react-native-purchases react-native-purchases-ui

Once the SDK is installed, configure it with your store API keys at the root of your application:

import Purchases from 'react-native-purchases'
import { Platform } from 'react-native'
useEffect(() => {
  Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG)
  if (Platform.OS === 'ios') {
    Purchases.configure({
      apiKey: process.env.EXPO_PUBLIC_KEY_IOS,
    })
  } else {
    Purchases.configure({
      apiKey: process.env.EXPO_PUBLIC_KEY_ANDROID,
    })
  }
}, [])

You can then display your paywall anywhere in your app using the RevenueCatUI.Paywall component:

import { View } from 'react-native'
import RevenueCatUI from 'react-native-purchases-ui'

return (
  <View style={{ flex: 1 }}>
    <RevenueCatUI.Paywall
      options={{ offering: offering }}
      onDismiss={() => {
        // Called after a purchase or when closing the paywall
      }}
    />
  </View>
)

Our products are now available on Android and iOS! No need to update the app for every design change—RevenueCat automatically displays the new paywall.

Paywall Mobile

Managing Subscriptions

RevenueCat simplifies subscription management by associating user entitlements with purchases via Entitlements. Each entitlement corresponds to an ID defining a user’s status (e.g., premium, gold) linked to the purchased products.

Once a subscription is active, the SDK makes it easy to retrieve the user’s status by identifying the entitlements associated with their active subscriptions:

const customerInfo = await Purchases.getCustomerInfo()
const activeEntitlements = customerInfo.entitlements.active

⚠️ The SDK updates the cache if the data is over 5 minutes old, but only when a purchase is made or getCustomerInfo() is called. To ensure up-to-date premium content access, call getCustomerInfo() whenever a user accesses premium content.

RevenueCat: A Turnkey Solution for Subscription Payments

RevenueCat offers many features to simplify subscription management, including:

Testing Sales Strategies

RevenueCat's modular products and ease of creating paywalls make it an ideal platform for testing different layouts and measuring their impact on sales. Several tools are available for this purpose:

Targeting: Customize Offer Display

The Targeting tab allows you to define rules to direct each user to the most relevant offer.

Targeting

RevenueCat offers two targeting strategies:

  • By app placement: Offers vary depending on where the user accesses the paywall (e.g., after onboarding for new users). Simply use getCurrentOffering(forPlacement: "placementIdentifier") in the SDK to retrieve the associated offer and display it via RevenueCatUI.Paywall.
  • By user attributes: Offer display is based on specific criteria (e.g., responses to an onboarding survey). Update user attributes with setAttributes() to dynamically adapt the presented offer.

Experiments: Optimize Offers with A/B Testing

Experiments enable testing and comparing different offers by randomly assigning them to user groups following the A/B testing principle. Once configured and integrated into an Experiment, RevenueCat automatically displays either version A or version B to users. Performance metrics, including conversion rates and revenue generated, are analyzed on a dedicated page, helping you choose the most effective offer.

Pricing

RevenueCat's pricing model is based on your app's generated revenue. The free tier allows access to all platform features as long as your gross monthly revenue does not exceed $2,500. Beyond this threshold, a 1% fee on gross monthly revenue applies. This cost should be considered for high transaction volumes.

Conclusion

RevenueCat significantly simplifies subscription and payment management, offering a seamless experience and quick integration. The generous free tier allows businesses to start without constraints, and centralizing offers across platforms is a major advantage. While some features, like the paywall editor, are still evolving and may have minor flaws, RevenueCat largely delivers on its promises! ✅

À découvrir également

App universelle avec Expo

29 Jan 2025

App universelle avec Expo

Au fil des années, Expo a considérablement amélioré sa plage de fonctionnalités, devenant...

par

Hugo

Retour d'expérience chez 20 Minutes : s'adapter au journalisme numérique

30 May 2024

Retour d'expérience chez 20 Minutes : s'adapter au journalisme numérique

Dans cet article, vous ne trouverez pas de snippets ou de tips croustillants sur React, seulement le récit d'une aventure plutôt ordinaire à travers le développement et l'évolution d'un projet technique.

par

Vincent

Intégration de module natif avec Expo Modules

24 Oct 2023

Intégration de module natif avec Expo Modules

En l'espace de presque deux ans, la popularité d'Expo a quintuplé, l'amenant au rang d'incontournable

par

Hugo

Premier Octet vous accompagne dans le développement de vos projets avec react-native

En savoir plusNous contacter
18 avenue Parmentier
75011 Paris
+33 1 43 57 39 11
hello@premieroctet.com

Suivez nos aventures

GitHub
X
Flux RSS

Naviguez à vue