You can test your In App purchases and S2S transaction from the Sandbox environment, without creating financial transactions, and it doesn’t process actual payments. It returns transactions as if payments were processed successfully.

The Apple Sandbox environment lets you test your In App purchases using StoreKit framework which makes use of real product information from App Store Connect.

⚠️ You can test only with an application that is setup on Apple App Store Connect with TestFlight

Steps to follow the test are as follows:

  1. How to create Sandbox Apple ID or Test account

    • Create Sandbox tester account in the App Store Connect in Users and Access-> Testers under Sandbox-> Click on + icon -> Enter Tester information (like name, email , password etc..) -> Click invite

  2. Signin to the App Store with Sandbox Apple ID

    • Build and run your app from Xcode inorder to run your app using your Sandbox Apple ID

    • In iOS and iPadOS, the Sandbox account is in Settings > App Store once you use the device make a purchase in a development-signed app. You need not sign out of the non Sandbox Apple ID account

    • In macOS, the Sandbox account is in App Store > Preferences once you make a purchase. You need to sign out of the Sandbox Apple ID after testing

    If your test device has macOS 11.1 or earlier installed, sign out of the Mac App Store, then build your app in Xcode and launch it from Finder.

    • The text [Environment: Sandbox] appears, indicating that you are connected to the test environment

    • You should be running a development-signed build of your app; production-signed builds use the production environment

  3. Test In-App purchase

    • In-app products created in App Store Connect are available for sale in all App Store region

    • To test in-app purchases in multiple regions using the same Sandbox Apple ID, open App Store Connect, click the Sandbox Apple ID, and change the App Store Country or Region setting

    • App Store Country or Region

      Change the account region for a tester to any of the 175 different regions for the App Store, allows you to continue testing on different storefronts using the same Sandbox Apple ID, without having to create new testers.

    • Subscription Renewal Rate

      https://help.apple.com/app-store-connect/#/dev7e89e149d

      • You can choose a subscription renewal rate for each tester to speed up or slow down how often subscriptions renew

      • Subscriptions are automatically canceled after 12 renewals

      • By default, a one month renewal lasts 5 minutes. If you wish to speed up the renewal period, you can choose 3 minutes

      • If you wish to slow down the renewal period, you can choose 15 minutes, 30 minutes, or an hour

    • To activate a storefront after you change the region in App Store Connect, sign out of the Sandbox Apple ID account and sign back in

    • Changing the App Store Country or Region setting affects the storefront value in your app

    • Interrupted Purchases

      • You can test interrupted purchase scenarios on a device running iOS 14 o by enabling interrupted purchases in App Store Connect for a specific tester ID

      • When it is selected the 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 or until resolved

      • all purchases will be interrupted for that Sandbox Apple ID, preventing the transaction from completing until resolved

      • 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 as if they need to agree to updated terms and conditions or they need to update an expired payment method.

  4. Clear Purchase history

  • To manage repeated testing with the same Sandbox Apple ID, clear its purchase history in App Store Connect

  • Clearing the purchase history with a high number of purchases may take longer

  • When the process is complete, the transaction history and receipt are empty and the Sandbox Apple ID will be eligible for introductory offers

  • The tester with the Sandbox Apple ID can purchase subscriptions they were previously subscribed to without causing a duplicate purchase

  • Clearing the purchase history doesn’t affect in-app purchases that customers make on the App Store.


Did this answer your question?