Skip to Content

RevenueCat Documentation

Overview

RevenueCat is integrated into this React Native app for subscription management, in-app purchases, and revenue analytics. It handles subscriptions across iOS App Store and Google Play Store, providing a unified API for managing purchases, entitlements, and customer data.

Configuration

RevenueCat is configured in app/_layout.tsx:

  • API Key: Set via EXPO_PUBLIC_REVENUE_CAT_PUBLIC_API_KEY environment variable
  • Log Level: Set to DEBUG for development
  • Platform Support: iOS and Android
  • Packages: Uses react-native-purchases and react-native-purchases-ui

Integration Details

Custom Hook: useSubscription

The app uses a custom hook hooks/useSubscription.ts that provides:

const { // State customerInfo, // Current customer information subscriptionInfo, // Active subscription details error, // Error messages isSubscribed, // Boolean: is user subscribed? packages, // Available purchase packages // Actions restorePurchases, // Restore previous purchases purchaseSubscription, // Purchase a subscription package manageSubscriptions, // Open subscription management (iOS only) refreshCustomerInfo, // Refresh customer data } = useSubscription();

RevenueCat UI Component

The app also includes a pre-built paywall using RevenueCatUI.Paywall (see app/offering.tsx):

<RevenueCatUI.Paywall onPurchaseStarted={handlePurchaseStarted} onPurchaseCompleted={handlePurchaseCompleted} onPurchaseError={handlePurchaseError} onRestoreStarted={handleRestoreStarted} onRestoreCompleted={handleRestoreCompleted} onRestoreError={handleRestoreError} />

Environment Setup

Add your RevenueCat API key to your environment variables:

  1. Log in to RevenueCat Dashboard 
  2. Select your project
  3. Navigate to the dashboard
  4. Go to SettingsAPI Keys
  5. Copy the SDK API Key for your platform and add it to your .env file:
EXPO_PUBLIC_REVENUE_CAT_PUBLIC_API_KEY=your_public_api_key_here

Resources