RevenueCat
Getting Started
Setting up RevenueCat in your SwiftStruct project.
Create a RevenueCat account
- Go to the RevenueCat website
- Click "Sign Up" and create an account
- Verify your email address
- Complete the onboarding process
Create a project and app
- After signing in, create a new project or select an existing one
- Navigate to your project dashboard
- Click "Add App" or the "+" button
- Select iOS as the platform
- Enter your iOS bundle ID (must match your Xcode project's bundle identifier)
- Give your app a name
- Click "Add App" to create it
Configure In-App Purchase Key
The In-App Purchase Key allows RevenueCat to validate purchases with Apple.
- Go to App Store Connect
- Sign in with your Apple Developer account
- Navigate to Users and Access → Integrations → In-App Purchase
- Click "Generate In-App Purchase Key" (if you haven't already)
- Give it a name (e.g., "RevenueCat")
- Click "Generate"
- Download the
.p8key file immediately (you can't download it again) - Note the Key ID and Issuer ID
- In RevenueCat, go to your app settings → Service Credentials → App Store
- Upload the
.p8file and enter the Key ID and Issuer ID - 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.
- In App Store Connect, go to Users and Access → Integrations → App Store Connect API
- Click the "+" button to generate a new key
- Give it a name (e.g., "RevenueCat API")
- Set the access level to App Manager or higher
- Click "Generate"
- Download the
.p8API key file immediately (you can't download it again) - Note the Key ID and Issuer ID
- In RevenueCat, go to your app settings → Service Credentials → App Store Connect API
- Upload the
.p8file and enter the Key ID and Issuer ID - Click "Save"
Configure Apple Server-to-Server Notifications
Server-to-Server notifications allow RevenueCat to receive real-time updates about subscription events.
- In App Store Connect, go to My Apps
- Select your app
- Go to App Information (under General)
- Scroll down to App Store Server Notifications
- In RevenueCat, go to your app settings → Apple Server to Server Notification Settings
- Copy the Production URL and Sandbox URL provided by RevenueCat
- Back in App Store Connect, paste the Production URL into the Production Server URL field
- Paste the Sandbox URL into the Sandbox Server URL field (if available)
- 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
- In App Store Connect, go to My Apps
- Select your app
- Go to Subscriptions (for subscriptions) or In-App Purchases (for consumables/non-consumables)
- Click the "+" button to create a new product
- 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
- Product ID: A unique identifier (e.g.,
- Click "Save"
- In RevenueCat, go to Products → Import from App Store
- Click "Sync" to import your products from App Store Connect
Option 2: Create products in RevenueCat
- In RevenueCat, go to Products
- Click "+ New" to create a new product
- Enter the Product Identifier (this will be created in App Store Connect)
- Select the product type (subscription, consumable, or non-consumable)
- Click "Save"
- RevenueCat will create the product in App Store Connect automatically (requires App Store Connect API key)
- Complete the product details in App Store Connect (pricing, localizations, etc.)
Create offerings and entitlements
- In RevenueCat, go to Entitlements
- Click "+ New" to create an entitlement (e.g., "pro")
- Give it an identifier and description
- Click "Save"
- Go to Offerings
- Create a new offering (e.g., "default")
- Add packages to your offering (e.g., monthly, annual)
- Attach the products you created to each package
- Assign entitlements to each package
Get your API key
- In RevenueCat, go to your project settings
- Navigate to API Keys
- Copy your Public App-specific API Key for iOS
- Keep this key secure and never commit it to version control
Configure your project
Add the following environment variable to your
.envfile:IOS_REVENUECAT_API_KEY=your-public-api-key-hereRun 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.