RevenueCat

Getting Started

Setting up RevenueCat in your SwiftStruct project.


Create a RevenueCat account

  1. Go to the RevenueCat website
  2. Click "Sign Up" and create an account
  3. Verify your email address
  4. Complete the onboarding process

Create a project and app

  1. After signing in, create a new project or select an existing one
  2. Navigate to your project dashboard
  3. Click "Add App" or the "+" button
  4. Select iOS as the platform
  5. Enter your iOS bundle ID (must match your Xcode project's bundle identifier)
  6. Give your app a name
  7. Click "Add App" to create it

Configure In-App Purchase Key

The In-App Purchase Key allows RevenueCat to validate purchases with Apple.

  1. Go to App Store Connect
  2. Sign in with your Apple Developer account
  3. Navigate to Users and AccessIntegrationsIn-App Purchase
  4. Click "Generate In-App Purchase Key" (if you haven't already)
  5. Give it a name (e.g., "RevenueCat")
  6. Click "Generate"
  7. Download the .p8 key file immediately (you can't download it again)
  8. Note the Key ID and Issuer ID
  9. In RevenueCat, go to your app settings → Service CredentialsApp Store
  10. Upload the .p8 file and enter the Key ID and Issuer ID
  11. Click "Save"

Configure App Store Connect API

The App Store Connect API key enables RevenueCat to automatically import products, apply price changes, and manage subscriptions.

  1. In App Store Connect, go to Users and AccessIntegrationsApp Store Connect API
  2. Click the "+" button to generate a new key
  3. Give it a name (e.g., "RevenueCat API")
  4. Set the access level to App Manager or higher
  5. Click "Generate"
  6. Download the .p8 API key file immediately (you can't download it again)
  7. Note the Key ID and Issuer ID
  8. In RevenueCat, go to your app settings → Service CredentialsApp Store Connect API
  9. Upload the .p8 file and enter the Key ID and Issuer ID
  10. Click "Save"

Configure Apple Server-to-Server Notifications

Server-to-Server notifications allow RevenueCat to receive real-time updates about subscription events.

  1. In App Store Connect, go to My Apps
  2. Select your app
  3. Go to App Information (under General)
  4. Scroll down to App Store Server Notifications
  5. In RevenueCat, go to your app settings → Apple Server to Server Notification Settings
  6. Copy the Production URL and Sandbox URL provided by RevenueCat
  7. Back in App Store Connect, paste the Production URL into the Production Server URL field
  8. Paste the Sandbox URL into the Sandbox Server URL field (if available)
  9. Click "Save"

Create products

You can create In-App Purchases (IAPs) and subscriptions in either App Store Connect or RevenueCat.

Option 1: Create products in App Store Connect

  1. In App Store Connect, go to My Apps
  2. Select your app
  3. Go to Subscriptions (for subscriptions) or In-App Purchases (for consumables/non-consumables)
  4. Click the "+" button to create a new product
  5. Fill in the required information:
    • Product ID: A unique identifier (e.g., com.yourapp.monthly_subscription)
    • Pricing: Set your price tier
    • Localizations: Add display names and descriptions
  6. Click "Save"
  7. In RevenueCat, go to ProductsImport from App Store
  8. Click "Sync" to import your products from App Store Connect

Option 2: Create products in RevenueCat

  1. In RevenueCat, go to Products
  2. Click "+ New" to create a new product
  3. Enter the Product Identifier (this will be created in App Store Connect)
  4. Select the product type (subscription, consumable, or non-consumable)
  5. Click "Save"
  6. RevenueCat will create the product in App Store Connect automatically (requires App Store Connect API key)
  7. Complete the product details in App Store Connect (pricing, localizations, etc.)

Create offerings and entitlements

  1. In RevenueCat, go to Entitlements
  2. Click "+ New" to create an entitlement (e.g., "pro")
  3. Give it an identifier and description
  4. Click "Save"
  5. Go to Offerings
  6. Create a new offering (e.g., "default")
  7. Add packages to your offering (e.g., monthly, annual)
  8. Attach the products you created to each package
  9. Assign entitlements to each package

Get your API key

  1. In RevenueCat, go to your project settings
  2. Navigate to API Keys
  3. Copy your Public App-specific API Key for iOS
  4. Keep this key secure and never commit it to version control

Configure your project

  1. Add the following environment variable to your .env file:

    IOS_REVENUECAT_API_KEY=your-public-api-key-here
    
  2. Run the environment sync command to apply the changes:

    npm run ios:env:sync
    

Your RevenueCat integration is now configured and ready to handle in-app purchases and subscriptions.

Previous
Getting started