13 KiB
In-App Purchase Setup Guide
This guide walks through setting up Monthly, Yearly, and Lifetime in-app purchases for SelfieCam using RevenueCat.
Prerequisites
- Apple Developer Program membership ($99/year)
- RevenueCat account (free tier available)
- Xcode with SelfieCam project
Part 1: App Store Connect Setup
Step 1: Create Your App
- Go to App Store Connect
- Click My Apps → + → New App
- Fill in:
- Platform: iOS
- Name: SelfieCam (or your app name)
- Primary Language: English (US)
- Bundle ID: Select your app's bundle ID (must match Xcode)
- SKU: A unique identifier (e.g.,
selfiecam2026)
- Click Create
Step 2: Create a Subscription Group
Subscriptions must belong to a group. Users can only have one active subscription per group.
- In your app, go to Subscriptions (left sidebar under "In-App Purchases")
- Click + next to "Subscription Groups"
- Enter group name:
SelfieCam Pro - Click Create
Step 3: Create Monthly Subscription
- In your subscription group, click + next to "Subscriptions"
- Fill in:
- Reference Name: Pro Monthly (internal only)
- Product ID:
com.mbrucedogs.SelfieCam.pro.monthly- Replace
yourcompanywith your actual company/developer name - This ID is permanent and cannot be changed
- Replace
- Click Create
- On the subscription page:
- Subscription Duration: 1 Month
- Subscription Prices: Click +, select your base country, enter price (e.g., $2.99/month)
- App Store Localization: Click +, add English (US):
- Display Name: Pro Monthly
- Description: Unlock all premium features with monthly access
- Click Save
Step 4: Create Yearly Subscription
- In your subscription group, click + next to "Subscriptions"
- Fill in:
- Reference Name: Pro Yearly
- Product ID:
com.mbrucedogs.SelfieCam.pro.yearly
- Click Create
- On the subscription page:
- Subscription Duration: 1 Year
- Subscription Prices: Enter price (e.g., $19.99/year - ~33% savings vs monthly)
- App Store Localization:
- Display Name: Pro Yearly
- Description: Best value! Unlock all premium features for a full year
- Click Save
Step 5: Create Lifetime (Non-Consumable)
Lifetime purchases are NOT subscriptions - they're non-consumable in-app purchases.
- Go to In-App Purchases (left sidebar, separate from Subscriptions)
- Click + → Non-Consumable
- Fill in:
- Reference Name: Pro Lifetime
- Product ID:
com.brumcedogs.SelfieCam.pro.lifetime
- Click Create
- On the product page:
- Price Schedule: Click +, select base country, enter price (e.g., $39.99)
- App Store Localization: Click +, add English (US):
- Display Name: Pro Lifetime
- Description: Pay once, own forever. All premium features unlocked permanently.
- Click Save
Step 6: Agreements and Tax Setup
Before you can sell, you must accept agreements:
- Go to Agreements, Tax, and Banking
- Accept the Paid Applications agreement
- Fill in your Bank Account information
- Fill in your Tax Forms (varies by country)
Note
: Products will show "Missing Metadata" until your app is submitted. This is normal.
Part 2: RevenueCat Setup
Step 1: Create RevenueCat Account
- Go to RevenueCat
- Click Get Started → Sign up
- Choose the free tier (covers up to $2,500/month in revenue)
Step 2: Create a Project
- After signup, click Create New Project
- Enter project name:
SelfieCam - Click Create Project
Step 3: Add Your iOS App
- In your project, go to Project Settings (gear icon) → Apps
- Click + New App
- Select App Store (iOS)
- Fill in:
- App Name: SelfieCam
- Bundle ID: Your exact bundle ID from Xcode (e.g.,
com.mbrucedogs.SelfieCam)
- Click Save Changes
Step 4: Connect to App Store Connect
RevenueCat needs your App Store Connect shared secret to validate receipts:
- In App Store Connect, go to your app → App Information (left sidebar)
- Scroll to App-Specific Shared Secret → Click Manage
- Click Generate if you don't have one
- Copy the shared secret
- Back in RevenueCat, go to Project Settings → Apps → your iOS app
- Paste the shared secret in App Store Connect App-Specific Shared Secret
- Click Save Changes
Step 5: Create Products in RevenueCat
- Go to Products (left sidebar)
- Click + New Product for each:
Product 1 - Monthly:
- Identifier:
com.mbrucedogs.SelfieCam.pro.monthly(must match App Store Connect exactly) - App: SelfieCam (iOS)
- Click Add
Product 2 - Yearly:
- Identifier:
com.mbrucedogs.SelfieCam.pro.yearly - App: SelfieCam (iOS)
- Click Add
Product 3 - Lifetime:
- Identifier:
com.mbrucedogs.SelfieCam.pro.lifetime - App: SelfieCam (iOS)
- Click Add
Step 6: Create an Entitlement
Entitlements represent what the user "gets" - your code checks for this.
- Go to Entitlements (left sidebar)
- Click + New Entitlement
- Enter identifier:
Selfie Cam by TopDog Pro(this matches the code inPremiumManager.swift) - Click Add
- Now attach all 3 products:
- Click on the
Selfie Cam by TopDog Proentitlement - Click Attach Products
- Select all 3 products (monthly, yearly, lifetime)
- Click Attach
- Click on the
Step 7: Create an Offering
Offerings group products for display in your paywall.
- Go to Offerings (left sidebar)
- You'll see a default offering already exists
- Click on default offering
- Click + New Package for each:
Package 1:
- Identifier: Select
$rc_monthlyfrom dropdown - Product: Select your monthly product
- Click Add
Package 2:
- Identifier: Select
$rc_annualfrom dropdown - Product: Select your yearly product
- Click Add
Package 3:
- Identifier: Select
$rc_lifetimefrom dropdown - Product: Select your lifetime product
- Click Add
Step 8: Get Your API Key
- Go to Project Settings (gear icon) → API Keys
- Copy your Public App-Specific API Key (starts with
appl_) - In your Xcode project, add this to
Configuration/Secrets.xcconfig:
REVENUECAT_API_KEY = appl_your_api_key_here
Important
: Never commit
Secrets.xcconfigto git. It should be in your.gitignore.
Part 3: Testing Purchases
There are three ways to test purchases without paying real money.
Option A: Debug Premium Toggle (Fastest - No Setup Required)
Use the built-in debug toggle to bypass premium checks entirely:
- Run the app in DEBUG mode
- Go to Settings → scroll to Debug section
- Toggle Enable Debug Premium on
- All premium features are now unlocked
This is useful for testing the UI but doesn't test the actual purchase flow.
Option B: StoreKit Configuration File (Local Testing)
Test purchases locally without App Store Connect:
-
Create a StoreKit Configuration File
- In Xcode: File → New → File → StoreKit Configuration File
- Name it
Products.storekit - Save it in the SelfieCam project folder
-
Add Your Products Click + in the editor and add:
Type Reference Name Product ID Auto-Renewable Subscription Pro Monthly com.mbrucedogs.SelfieCam.pro.monthlyAuto-Renewable Subscription Pro Yearly com.mbrucedogs.SelfieCam.pro.yearlyNon-Consumable Pro Lifetime com.mbrucedogs.SelfieCam.pro.lifetimeFor subscriptions, create a subscription group called "SelfieCam Pro" first.
-
Enable It in Your Scheme
- Product → Scheme → Edit Scheme (or ⌘<)
- Select Run → Options tab
- Set StoreKit Configuration to your
Products.storekitfile
-
Test Purchases
- Run the app in Simulator or on device
- Purchases are instant and free
- Manage transactions: Debug → StoreKit → Manage Transactions
Note
: StoreKit Configuration testing works with RevenueCat but transactions won't appear in the RevenueCat dashboard.
Option C: Sandbox Testing (Full Integration Test)
Test the complete flow with App Store Connect and RevenueCat:
-
Create a Sandbox Tester Account
- Go to App Store Connect → Users and Access → Sandbox → Testers
- Click + to add a new tester
- Use a fake email you control (not a real Apple ID)
- Set a password you'll remember
-
Sign Out of App Store on Your Test Device
- Settings → App Store → Tap your Apple ID → Sign Out
- Don't sign back in yet
-
Run Your App and Make a Purchase
- Run the app on a physical device (recommended) or simulator
- Tap a purchase button
- When prompted to sign in, use your sandbox tester credentials
- Complete the purchase - it's free!
-
Verify in RevenueCat
- Go to RevenueCat dashboard → Customers
- Search for your sandbox user
- You should see their entitlement and transaction
Sandbox Subscription Renewal Times:
| Real Duration | Sandbox Duration |
|---|---|
| 1 week | 3 minutes |
| 1 month | 5 minutes |
| 2 months | 10 minutes |
| 3 months | 15 minutes |
| 6 months | 30 minutes |
| 1 year | 1 hour |
Subscriptions auto-renew up to 6 times in sandbox, then expire.
Setup Checklist
App Store Connect
- App created with correct bundle ID
- Subscription group created (
SelfieCam Pro) - Monthly subscription created with price and localization
- Yearly subscription created with price and localization
- Lifetime non-consumable created with price and localization
- Paid Apps agreement accepted
- Bank and tax info submitted
- Sandbox tester account created
RevenueCat
- Account created
- Project created
- iOS app added with bundle ID
- Shared secret from App Store Connect added
- 3 products created (matching App Store Connect IDs exactly)
proentitlement created- All 3 products attached to
proentitlement - Default offering has 3 packages (monthly, annual, lifetime)
- API key copied to
Secrets.xcconfig
Xcode
Secrets.xcconfigcontainsREVENUECAT_API_KEYSecrets.xcconfigis in.gitignore- (Optional) StoreKit Configuration file created for local testing
Troubleshooting
Products Not Loading
- Verify product IDs match exactly between App Store Connect and RevenueCat
- Check that the RevenueCat API key is correctly set in
Secrets.xcconfig - Ensure the shared secret is added in RevenueCat
- Products may take a few minutes to propagate after creation
Sandbox Purchases Failing
- Make sure you're signed out of the regular App Store
- Use sandbox credentials, not your real Apple ID
- Check that agreements are accepted in App Store Connect
- Verify the device isn't in a restricted region
RevenueCat Not Showing Transactions
- Sandbox transactions can take a minute to appear
- Verify the bundle ID matches exactly
- Check that products are attached to the entitlement
- Look at RevenueCat's debug logs in Xcode console
"Missing Metadata" in App Store Connect
This is normal until you submit your app for review. Products will work in sandbox despite this warning.
Code Reference
The following files handle in-app purchases:
| File | Purpose |
|---|---|
Shared/Premium/PremiumManager.swift |
RevenueCat integration, purchase logic, customer info listener |
Shared/Premium/PaywallPresenter.swift |
RevenueCat native Paywall with custom fallback |
Features/Paywall/Views/ProPaywallView.swift |
Custom fallback paywall UI |
Features/Onboarding/Views/OnboardingSoftPaywallView.swift |
Onboarding soft paywall |
Features/Settings/Views/SettingsView.swift |
Pro section with Customer Center |
Configuration/Secrets.xcconfig |
RevenueCat API key (not committed to git) |
The code checks for a single entitlement called "Selfie Cam by TopDog Pro". All three products (monthly, yearly, lifetime) grant this same entitlement, so the app doesn't need to know which one the user purchased.
RevenueCat Features Used
- RevenueCat SDK - Core purchase and subscription management
- RevenueCatUI - Native paywalls and Customer Center
- PaywallView - Remote-configurable paywall designed in RevenueCat dashboard
- Customer Center - Subscription management UI (view plan, cancel, request refund)