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.
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
plus_monthly: Plus Monthly Subscription
plus_annual: Plus Annual Subscription
Offering
Details
default
Packages containing the products listed above
This means when you fetch the defaultOffering 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.
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.