Test in-app purchases

Overview of testing in sandbox

Apple provides a sandbox environment that lets you test in-app purchases and Apple Pay transactions using test accounts without incurring charges. This environment uses the infrastructure of the App Store and returns transactions as if payments were successfully processed instead of processing actual payments.

You can test the following scenarios:

Scenario

Description

Testing App Store country or region

Test on different storefronts using the same Sandbox Apple ID, without having to create new testers. Associate your sandbox testers with any of the 175 App Store storefronts.

Testing auto-renewable subscription events

Test auto-renewable subscription events, such as renewals, state changes and interrupted purchases without having to wait the length of the subscription duration.

Testing App Store Server Notifications

Test that your server receives App Store Server Notifications and notifications for the sandbox environment.

Testing Family Sharing

Create Sandbox Test Families to test Family Sharing in your app and share access to auto-renewable subscriptions and non-consumables with up to five test family members.

Testing Apple Pay transactions

Test your app's implementation of Apple Pay with test credit and debit cards. Learn more.

To get started, create Sandbox Apple IDs in App Store Connect and use them to sign in to devices that are running a development-signed version of your app. You’ll need to enable Developer Mode on each device so you can use it to test your app.

Alternatively, you can test in-app purchases with StoreKit Testing in Xcode, a local test environment that doesn’t require a connection to App Store servers to test in-app purchases. Use StoreKit Testing in Xcode to test in-app purchases before you configure them in App Store Connect or to test your code when a network connection isn’t available. Learn how to test in-app purchases with Xcode and sandbox.