Testing in-app purchases (Optional)
7 minBefore shipping your app to production, you'll want to test the complete purchase flow. There are two approaches to testing in-app purchases: RevenueCat Test Store for fast, deterministic testing without any sandbox account setup, and Apple Sandbox Testing for end-to-end testing with Apple's infrastructure.
RevenueCat Test Store
Test Store is RevenueCat's built-in testing environment that allows you to test in-app purchase flows without connecting to the App Store. It's automatically provisioned with every RevenueCat project and gives you complete control over purchase outcomes.
Key benefits of using Test Store:
- Deterministic outcomes: Control whether purchases succeed, fail, or get cancelled — no more flaky sandbox behavior.
- No sandbox accounts needed: Skip the hassle of creating and managing Apple Sandbox tester accounts.
- Fast feedback: Test purchase flows in seconds rather than minutes.
- Works in CI/CD: Write automated tests for your purchase logic that run reliably in any environment.
To get started with Test Store, navigate to your RevenueCat dashboard, go to Apps & providers, and enable Test Store. You'll receive a Test Store API key prefixed with test_ that you can use in place of your production API key during development and testing.
Apple Sandbox Testing
Apple provides a Sandbox environment that simulates the App Store without charging real money. This section covers everything you need to make a successful test purchase using Apple's Sandbox.
Understanding the Sandbox Environment
The Sandbox is Apple's testing environment for in-app purchases. Key characteristics:
- No real charges: All transactions are simulated.
- Accelerated renewals: Subscriptions renew faster for testing (see table below).
- Separate from production: Sandbox purchases don't affect your real App Store data.
- Requires a Sandbox Apple ID: You cannot use your regular Apple ID.
Sandbox Subscription Renewal Schedule
Subscriptions renew much faster in Sandbox to allow rapid testing:
| Production 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 |
1. Create a Sandbox Tester Account
You need a dedicated Sandbox Apple ID to test purchases. This is different from your regular Apple ID.
- Go to App Store Connect.
- Click Users and Access in the top navigation.
- Select the Sandbox tab.
- Click the + button to add a new tester.
- Fill in the required information:
- First Name / Last Name: Can be anything (e.g., "Test User").
- Email: Must be a real email you can access, but it cannot be an existing Apple ID.
- Password: Create a password for this test account.
- Secret Question/Answer: For account recovery.
- Territory: Select a country (affects currency and pricing).
- Click Create.
yourname+sandbox1@gmail.com) if your email provider supports them.
2. Configure Your Test Device
To use the Sandbox account on your iOS device:
Option A: iOS 14 and Later (Recommended)
- Open Settings on your device.
- Navigate to App Store.
- Scroll down to the Sandbox Account section.
- Tap Sign In and enter your Sandbox tester credentials.
This keeps your regular Apple ID signed in while using the Sandbox account specifically for testing purchases.
Option B: iOS 13 and Earlier
- Open Settings > iTunes & App Store.
- Sign out of your regular Apple ID.
- When prompted during a purchase in your app, sign in with the Sandbox account.
3. Make a Test Purchase
With your Sandbox account configured, you can now test the complete purchase flow:
- Build and run your app on a physical device (Sandbox doesn't work reliably on Simulator).
- Navigate to your paywall and select a product to purchase.
- Complete the purchase: You'll see "[Environment: Sandbox]" in the confirmation dialog.
- Verify in RevenueCat: Check the customer's profile in your RevenueCat dashboard to confirm the purchase was recorded.
What to Test
- ✅ Initial purchase: Complete a subscription or one-time purchase.
- ✅ Restore purchases: Sign out and back in, then restore.
- ✅ Subscription renewal: Wait for automatic renewal (based on Sandbox timing).
- ✅ Cancellation: Cancel via Settings and verify entitlement is removed.
- ✅ Upgrade/Downgrade: Switch between subscription tiers.
4. Verify in RevenueCat Dashboard
After making a test purchase, verify it appears correctly in RevenueCat:
- Go to your RevenueCat dashboard.
- Navigate to Customers in the left sidebar.
- Search for your test user (by App User ID or email if you've set one).
- Verify:
- The purchase appears in the transaction history
- The correct entitlement is active
- The product and offering information is accurate
5. Testing with TestFlight (Optional)
For more realistic testing with external testers, you can use TestFlight:
- Internal testers: Uses Sandbox environment automatically.
- External testers: Also uses Sandbox environment.
- TestFlight builds use Sandbox for purchases, never charging real money
This allows you to get feedback from beta testers without worrying about real transactions.
Common Sandbox Issues
| Issue | Solution |
|---|---|
| Purchase dialog doesn't appear | Ensure you're on a physical device, not Simulator |
| "Cannot connect to App Store" | Check network connection; try signing out and back in |
| Purchases not showing in RevenueCat | Verify Bundle ID matches; check credentials are configured |
| Asked for regular Apple ID password | Ensure Sandbox account is configured in Settings (iOS 14+) |
| "This Apple ID has not yet been used" | Normal for first purchase; follow prompts to accept terms |
Once you've successfully completed a test purchase and verified it in RevenueCat, you're ready to ship your app with confidence! 🚀