Sandbox Testing
Test your in-app purchase implementation using Apple's StoreKit sandbox environment before going to production.
Testing Optionsโ
| Method | Environment | Requires App Store Connect |
|---|---|---|
| StoreKit Configuration File | Xcode Simulator / Device | No |
| Sandbox Account | Device only | Yes |
| TestFlight | Device only | Yes |
StoreKit Configuration File (Recommended for Development)โ
The fastest way to test purchases locally without needing App Store Connect.
- In Xcode, go to File โ New โ File
- Select StoreKit Configuration File
- Add your products (subscriptions, consumables, etc.)
- In your scheme, set the StoreKit Configuration under Run โ Options โ StoreKit Configuration
The StoreKit configuration file lets you test the full purchase flow in the simulator โ including renewals, cancellations, refunds, and Ask to Buy.
Sandbox Testing (Device)โ
For more realistic testing on a physical device:
- Create a Sandbox Apple ID in App Store Connect โ Users and Access โ Sandbox Testers
- On your test device, sign out of the App Store
- Run your app and make a purchase โ you'll be prompted to sign in with the sandbox account
Sandbox Subscription Behaviorโ
Sandbox subscriptions renew at an accelerated rate:
| Duration | Sandbox Renewal |
|---|---|
| 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-12 times in sandbox, then expire.
Debugging Tipsโ
Enable SDK Loggingโ
- iOS
- Android
- Flutter
- React Native
// Local mode
AppActor.configure(
projectKey: "myapp",
logLevel: .debug, // Enable verbose SDK logging
offerings: { /* ... */ },
entitlements: { /* ... */ }
)
// Payment mode
AppActor.configure(
apiKey: "pk_test_your_key",
options: .init(logLevel: .debug)
)
SDK logs appear in Xcode's console with the [AppActor] prefix. Key events logged:
| Event | Level |
|---|---|
| Configuration success/failure | info/error |
| Product fetch results | info/warning |
| Transaction processing | info |
| Purchase outcomes | info |
| Entitlement rebuilds | debug |
| Cache operations | debug |
Common Issuesโ
Products not loading:
- Verify product IDs match App Store Connect exactly
- Check that your Paid Applications agreement is signed
- Ensure the StoreKit configuration file is selected in your scheme
Purchases failing:
- Check that you're signed in with a sandbox account (not a production Apple ID)
- Verify your app's bundle ID matches App Store Connect
Entitlements not updating:
- Call
onAppForeground()to refresh state - Use
getCustomerInfo(forceRefresh: true)for an immediate check - Check SDK logs for transaction processing details
Sandbox renewals not working:
- Sandbox renewals happen every 3-5 minutes (not at production intervals)
- Each subscription renews 6-12 times, then expires with
autoRenew: false - Make sure
Transaction.updateslistener is active (callonAppForeground())
TestFlight Testingโ
TestFlight uses the sandbox environment automatically. Your testers can make purchases without being charged.
- Upload your build to App Store Connect
- Add testers (internal or external)
- Testers install via TestFlight and can test purchases
TestFlight builds use the sandbox environment. Purchases are free and subscriptions renew at accelerated rates.
Next Stepsโ
- Launch Checklist โ Verify everything before production