Monetization
Setting up In-App subscription for your porject using RevenueCat
In-app subscriptions are a great way to generate recurring revenue from your app. Managed by the App Store and Play Store, Apple and Google take care of taxes and payment processing. In return, they charge a 30% commission on your revenue (15% on the first $1M if you apply for their program).
You cannot use Stripe or any other payment method to handle subscriptions in your app. Apple and Google could reject your app or even ban your account.
Setting up RevenueCat
ExpoStarter relies on the RevenueCat to handle in-app purchases and subscriptions in the easiest and quickest way.
RevenueCat Documentation here
The ExpoStarter boilerplate comes out of the box with the following pre-configured example offering:
Entitlement | Products | Subscriptions |
---|---|---|
pro | Pro | pro_monthly : Pro Monthly Subscription |
pro_annual : Pro Annual Subscription | ||
plus | Plus | pro_monthly : Plus Monthly Subscription |
plus_annual : Plus Annual Subscription |
Offering | Details |
---|---|
default | Packages containing the products listed above |
This means when you fetch the default
Offering within the app, you get those Packages and you can display the Paywall associated to it.
When an user purchases one of the Products, he is granted with the Entitlement associated to that product. Therefore you can easily check if the user has an Entitlement active to display or not the Premium features within your app.
In order to get this functional, you need to sign up for free in RevenueCat and create a new project.
We will go through it in the following sections.
How to setup it with your project?
You must have an account and an app created on RevenueCat. After that create the subscriptions on the Apple Store and Google Play Store.
You don't have to install anything. ExpoStarter is already configured to work with RevenueCat.
Configuration for iOS
Check out the default API documentation
Configuration for Android
Check out the default API documentation
Configuration for Web
Check out the default API documentation
Integrating webhooks
RevenueCat offers a webhook system to manage subscription events. By default, the project is set up to retrieve the subscription state from your backend, but you can also fetch it directly from RevenueCat.
You can modify this behavior in the packages/api/revenuecat/webhook
file.
The get
method includes a call to the backend to fetch the subscription state. It also has a commented-out section of code for fetching the subscription state directly from RevenueCat, which you can use if preferred.
Fetching the subscription state via your backend allows for handling more complex scenarios, such as offering a free lifetime subscription to specific users.
To set up the webhook in the RevenueCat dashboard, follow this documentation.
Check the user subscription state
To listen to subscription state changes you can use the hooks useIsPro
or useIsPlus
wherever you want in your app.