Skip to main content

Test in-app purchases in App Store

Once you've configured everything in the Adapty Dashboard and your mobile app, it's time to conduct in-app purchase testing.

Note: none of the test tools charge users when they test buying a product. The App Store doesn’t send emails for purchases or refunds made in the test environments.

info

To proceed with in-app purchases testing, make sure:

  • You’ve completed the quickstart guides on store integration, adding products, and the Adapty SDK integration.
  • Your product is marked Ready to submit in App Store Connect.

Sandbox testing

info

We recommend testing in-app purchases with a real device. While sandbox purchases can run on simulators, real devices are needed to fully test all flows, including payment dialogs and biometric prompts.

You have two main ways to test in-app purchases:

  • Build in Xcode and run on a test device: Convenient for developers and QA engineers.
  • Use a sandbox test account with TestFlight: Suitable for anyone else.

Both these options are covered in the guide below.

Step 1. Create Sandbox test account in App Store Connect

warning

Create a new Sandbox test account to ensure your purchase history is clean. If you reuse an existing account, any previously purchased products will remain available, and you won’t be able to test buying them again.

You can create a new Sandbox test account in a few clicks:

  1. Go to Users and Access > Sandbox > Test Accounts in App Store Connect and click +.
  1. Enter the test user details. Make sure to define the Country or Region which you plan to test as it impacts the product availability for the region and purchase currency.
tip
  • If you use Gmail or iCloud, you can reuse your existing email address with plus sign subaddressing.
  • You can use a random email address that doesn't even exist, but make sure to decline two-factor authentication (2FA) when you sign in on a test device later.
  1. Click Create.

Step 2. Enable the Developer mode

note

Skip this step if the Developer mode is already enabled on your test device.

You’ll need a Mac with Xcode installed and your test device cable:

  1. Open Xcode on your Mac. If you're going to test in-app purchases with TestFlight, you only need to have XCode installed; you don't need to have an app there.
  2. Connect your test device to the Mac using the cable.
  3. Go to Settings > Privacy & Security > Developer Mode on your test device and turn on Developer Mode.

Step 3. Download the app from TestFlight

info

This step applies only if you're testing with TestFlight. If you’re building the app in Xcode, skip this step.

For details on submitting your app to TestFlight, go to the Apple documentation.

Before downloading the TestFlight app, on your test device, make sure you are signed in with your production Apple Account. Then download the app you test from TestFlight.

danger

Do not open the app once downloaded. Just proceed with the next steps. If accidentally opened, remove it from your test device and download it again. Otherwise, your purchase history may not be clear, and testing in-app purchases will lead to errors.

Step 4. Switch to Sandbox test account

  1. Go to Settings > Your Apple Account > Media & Purchases on your test device.
  2. Select Sign Out from the pop-up menu.
  3. Go to Settings > Developer. If the Developer option is not available, make sure you've enabled it in step 2.
  1. Scroll down to the Sandbox Apple Account section and tap Sign In.
  1. Sign in with your Sandbox Apple Account credentials.

Step 5. Clear purchase history

If you've just created a new Sandbox test account and switched to it, you can skip this step as it only applies to repeated testing using the same Sandbox test account.

  1. Go to Settings > Developer > Sandbox Apple Account on your test device.
  2. Select Manage from the pop-up menu.
  3. Go to Account Settings and tap Clear Purchase History.
danger

This step is required each time you repeat testing using the same Sandbox test account. In this case, you will also need to sign out from your Sandbox test account, then sign in again to clear the purchase history cache on the test device.

Step 6. Build in Xcode and run

info

This step applies only if you're testing with an Xcode build. If you're using TestFlight, skip this step.

  1. Connect your test device to your Mac1.
  2. Open Xcode.
  3. Click Run in the toolbar or choose Product > Run to build and run the app on the connected device.

If the build is successful, Xcode will launch the app on your device and open a debugging session in the debug area..

Your app is now ready for testing on the device.

Step 7. Make test purchase

Open the app and make your test purchase through a paywall.

Once done, go to the article on validating test purchases to check your results.

Step 8. Keep testing

Now, your testing environment is all set. If you want to test it once again, don't forget to clear the purchase history of the sandbox account.

Testing issues

Below are common issues you may encounter when testing an app.

TestFlight issues

You can't clear your purchase history if you use TestFlight without the Sandbox test account, which results in various issues and false testing outcomes.

If you accidentally forgot to switch to the Sandbox test account and opened the app even once, TestFlight attributes your purchase history to your production Apple Account, which brings unexpected issues.

To fix it, follow these steps:

  1. Remove the app from the test device.
  2. Follow the steps for Sandbox testing.
note

It's important to not only reinstall the app, but also switch to the Sandbox test account, clear purchase history, and launch it using the Sandbox test account.

Shared access levels issues

If you repeat testing using the same Sandbox test account, you may face unexpected behavior with shared access levels for the test user.

To check if the user has an inherited access level, go to Profiles & Segments from the Adapty Dashboard and open the user's profile.

If the user has an inherited access level, follow these steps for accurate testing results:

  1. Delete the parent profile.
  2. Remove the app from the test device.
  3. Download the app from TestFlight.
  4. Switch to Sandbox test account.
  5. Clear purchase history.
  6. Open the app and make your test purchase.

Updating app in TestFlight

If the TestFlight app has been updated:

  1. Remove the app from the test device.
  2. Download the app from TestFlight.
  3. Switch to Sandbox test account.
  4. Clear purchase history.
  5. Open the app and make your test purchase.

Authorization during the purchase process

If you have downloaded the TestFlight app and haven't logged into the sandbox account from the device settings, logging into it during the purchase process won't work. For purchase to succeed, you must log into your sandbox account from the device settings before attempting to make a purchase.

Test subscriptions

When testing the app using the Sandbox test account, you can set up the subscription renewal rate for each tester in sandbox. Learn more about editing subscription renewal rates in the official Apple documentation.

By default, subscriptions renew up to 12 times before they stop, according to the following schedule:

Subscription duration1 week1 month2 months3 months6 months1 year
Subscription renewal speed3 minutes5 minutes10 minutes15 minutes30 minutes1 hour
Length of Billing Retry10 minutes10 minutes10 minutes10 minutes10 minutes10 minutes
Length of Billing Grace Period3 minutes5 minutes5 minutes5 minutes5 minutes5 minutes
note

Keep in mind that test transactions take up to 10 minutes to appear in the Event feed.

Test offers

Testing offers requires all user receipts to be deleted for eligibility to work correctly.

The most reliable way to test offers is using a completely new Sandbox test account. Repeated testing using the same Sandbox test account may cause unexpected behavior.

danger

If you repeat testing using the same Sandbox test account, make sure to clear purchase history to avoid eligibility-related issues.