Test in-app purchases
Apple provides a testing environment called Sandbox, which let you test in-app purchases without incurring charges using test accounts. Sandbox uses the infrastructure of the App Store but doesn’t process actual payments. Instead, it returns transactions as if payments were processed successfully.
In-app purchases don’t need to be approved by App Review prior to testing. Learn how to test in-app purchases with Xcode and Sandbox.
You can add sandbox testers and manage the following settings for them in App Store Connect:
App Store country or region
You can associate your test account with any of the 175 App Store storefronts. This lets you test on different storefronts using the same sandbox Apple ID, without having to create new testers.
Once you change the country or region, you’ll need to sign in again with your sandbox Apple ID on your device to complete this change.
Subscription renewal speed
Sandbox lets you test subscription events, such as renewals, state changes, and interrupted purchases, without having to wait the length of the subscription duration. Once you added testers in sandbox, you can choose a subscription renewal speed for each tester to determine how quickly subscriptions renew. By default, accounts are set to a speed equalization of 1 month = 5 minutes, but you can slow down or speed up the renewal period, based on the options below. Subscriptions renew up to 12 times before auto-renewal turns off on the thirteenth renewal attempt.
Sandbox subscription time accelerated options: |
Subscription Duration |
Renewal every 3 Minutes |
Renewal every 5 minutes (Default) |
Renewal every 15 minutes |
Renewal every 30 minutes |
Renewal every hour |
|
---|---|---|---|---|---|---|---|
1 week |
3 minutes |
3 minutes |
5 minutes |
10 minutes |
15 minutes |
||
1 month |
3 minutes |
5 minutes |
15 minutes |
30 minutes |
1 hour |
||
2 months |
6 minutes |
10 minutes |
30 minutes |
1 hour |
2 hours |
||
3 months |
9 minutes |
15 minutes |
45 minutes |
1 hour 30 minutes |
3 hours |
||
6 months |
18 minutes |
30 minutes |
1 hour 30 minutes |
3 hours |
6 hours |
||
1 year |
36 minutes |
1 hour |
3 hours |
6 hours |
12 hours |
Interrupted purchases
You can test interrupted purchase scenarios on a device running iOS 14 or later by enabling interrupted purchases in App Store Connect for a specific Sandbox Apple ID. If this option is selected, on-device purchase attempts by that Sandbox Apple ID will be interrupted in the sandbox environment and continue to be interrupted until the option is deselected or the tester agrees to terms and conditions on their iOS device. This allows you to test your app’s handling of an interruption to ensure a seamless customer experience.
In general, an interrupted purchase is experienced anytime a customer needs to address an issue with their Apple ID. For example, they may need to agree to updated terms and conditions or update an expired payment method.
To learn what to test and how to use your device to test, view documentation on testing interrupted purchases and testing in-app purchases.
Billing Retry
The following chart describes Billing Retry and Billing Grace Period renewal speeds in the sandbox environment. If enabled, Billing Grace Period starts at the same time as Billing Retry, and ends either when Billing Retry expires or when the subscription is recovered or cancelled — whichever happens first.
Sandbox attempts to recover subscriptions at least six times during the billing retry state.
Renewal every 3 Minutes
Billing Retry |
Billing Grace Period |
|
---|---|---|
Weekly subscriptions |
6 minutes |
3 minutes |
Monthly and yearly subscriptions |
6 minutes |
3 minutes |
Renewal every 5 minutes (default)
Billing Retry |
Billing Grace Period |
|
---|---|---|
Weekly subscriptions |
10 minutes |
3 minutes |
Monthly and yearly subscriptions |
10 minutes |
5 minutes |
Renewal every 15 minutes
Billing Retry |
Billing Grace Period |
|
---|---|---|
Weekly subscriptions |
30 minutes |
5 minutes |
Monthly and yearly subscriptions |
30 minutes |
15 minutes |
Renewal every 30 minutes
Billing Retry |
Billing Grace Period |
|
---|---|---|
Weekly subscriptions |
1 hour |
10 minutes |
Monthly and yearly subscriptions |
1 hour |
30 minutes |
Renewal every hour
Billing Retry |
Billing Grace Period |
|
---|---|---|
Weekly subscriptions |
15 minutes |
2 hours |
Monthly and yearly subscriptions |
1 hour |
1 hours |
Learn how to test in-app purchases with sandbox.
Required role: Account Holder, Admin, App Manager, or Developer. View role permissions.
Editing tester settings
To modify the settings for a sandbox tester:
-
From Users and Access, click Sandbox Testers to view Sandbox Apple IDs.
-
Click the Sandbox Apple ID you want to modify.
-
In the dialog that appears, make your desired edits.
-
Click Save.
Clearing purchase history
You can clear the purchase history for a tester to continue testing with the same Sandbox Apple ID. Clearing purchase history will delete all past auto-renewable subscriptions and nonconsumables purchased by the selected testers in the sandbox environment. Customer accounts aren’t affected.
To clear tester purchase history:
-
From Users and Access, under Sandbox, click Sandbox Testers.
-
Click Edit.
-
Select the testers you want to modify and click Clear Purchase History.
-
Click Clear Purchase History in the dialog that appears.
Sandbox Apple IDs with a high number of purchases may take longer to clear. This action cannot be reversed.