Revenuecat Setup

RevenueCat Setup Guide

Overview

RevenueCat manages in-app purchases and subscriptions for Civix across iOS and Android.


Step 1: Create RevenueCat Account

  1. Go to https://app.revenuecat.com
  2. Sign up with email or GitHub
  3. Verify your email

Step 2: Create a New Project

  1. Click "Create New Project"
  2. Name: Civix or US Civics Test
  3. Save the project

Step 3: Add iOS App

  1. In your project, click "Apps" → "Add App"
  2. Select "Apple App Store"
  3. Enter:
    • App Name: Civix
    • Bundle ID: com.civics.test
  4. Get your iOS API Key (Public SDK Key)
  5. Save it - you'll need it for lib/purchases.ts

Connect to App Store Connect

  1. In RevenueCat, go to your iOS app → "App Store Connect API"
  2. Follow the guide to create an API key in App Store Connect:
  3. Enter in RevenueCat:
    • Issuer ID: From App Store Connect
    • Key ID: From App Store Connect
    • Upload the .p8 file

Step 4: Add Android App

  1. Click "Add App" → "Google Play Store"
  2. Enter:
    • App Name: Civix
    • Package Name: com.civics.test
  3. Get your Android API Key (Public SDK Key)

Connect to Google Play Console

  1. In Google Play Console, go to "Setup" → "API Access"
  2. Create a new service account
  3. Grant "Admin" access
  4. Download the JSON credentials file
  5. Upload to RevenueCat

Step 5: Create Products in RevenueCat

Entitlements

  1. Go to "Entitlements" → "Create New"
  2. Create: premium
    • This is what the app checks for premium access

Products

  1. Go to "Products" → "Create New"
  2. Create these products:
Product IDTypePlatform
civix_monthlyAuto-Renewable SubscriptioniOS & Android
civix_annualAuto-Renewable SubscriptioniOS & Android
civix_lifetimeNon-ConsumableiOS & Android
  1. Link each product to the premium entitlement

Offerings

  1. Go to "Offerings" → "Create New"
  2. Name: default
  3. Add packages:
    • $rc_monthlycivix_monthly
    • $rc_annualcivix_annual
    • $rc_lifetimecivix_lifetime

Step 6: Update App Code

Edit /lib/purchases.ts:

// Replace these with your actual API keys
const REVENUECAT_IOS_KEY = "appl_YOUR_IOS_KEY_HERE";
const REVENUECAT_ANDROID_KEY = "goog_YOUR_ANDROID_KEY_HERE";

Step 7: Testing

iOS Sandbox Testing

  1. Create a Sandbox Tester in App Store Connect
  2. Sign out of App Store on device
  3. When prompted during purchase, use sandbox credentials
  4. Subscriptions renew every 5 minutes in sandbox

Android Test Accounts

  1. In Play Console, add license testers
  2. Use those Google accounts on test devices
  3. Test purchases will be free

RevenueCat Dashboard

  • Monitor purchases in real-time
  • Check "Customers" to see test transactions
  • Use "Debug" mode to verify SDK integration

Checklist

  • RevenueCat account created
  • iOS app added with API key
  • Android app added with API key
  • App Store Connect API connected
  • Google Play API connected
  • premium entitlement created
  • 3 products created (monthly, annual, lifetime)
  • Default offering configured
  • API keys updated in lib/purchases.ts
  • Sandbox testing completed on iOS
  • Test purchases completed on Android