In-App Purchase Testing Tips

This guide describes how to test in-app purchases in your iOS app

About iOS 14 Local Testing (will be available soon)

During WWDC 2020 Apple announced a new way to test in-app purchases using StoreKit configuration file.

At the moment, in-app purchases validation made using StoreKit configuration file is not yet supported. We will announce when this feature becomes available in Apphud.

How to Change Sandbox Apple ID

If you want to change sandbox Apple ID in order to test in-app purchases from scratch, like testing Trials or paid Introductory Offers, please follow these steps:

  • Create new sandbox account

  • Delete the app from iOS device

  • Delete your test user in Apphud (To find yourself go to Users > View Sandbox Users)

  • Change Apple ID in device

  • Run the app again and make purchases

Testing Integrations

Please read here.

Do not forget to call Apphud.setFinishTransactions()

This section is suitable only if you purchase subscriptions using Apphud SDK, i.e. you call Apphud.purchase(product) method in your App. If you purchase subscriptions with your own code, skip this section.

Call Apphud.setFinishTransactions() before SDK initialization to tell Apphud to finish all transactions, even those that are stuck in the queue for some reason.

This is useful when you test purchases a lot / change sandbox Apple IDs / break execution during purchases, etc.

This method is also helpful in production, sometimes it reduces errors in purchasing a subscription.

Force a Fresh Install in Apphud

If you want to change User ID / Device ID in order to test a new sandbox account, there is no need to write this paragraph; please read How to Change Sandbox Apple ID instead.

Currently, User ID and Device ID values are being saved in keychain on your device. Even if you change User ID, you will still have the same user with changed User ID. You can initialize Apphud SDK with different Device ID to force a fresh install.

func startManually(apiKey: String, userID: String? = nil, deviceID: String? = nil)

This method should not be used in production unless you know what you are doing.

How to Create a New Sandbox Apple ID

You can read more about testing and setting up auto-renewable subscriptions in our blog.

To test in app purchases you need to create sandbox user. Go to App Store Connect and open "Users and Access", then – "Sandbox Testers":

You can read more about creating sandbox testers here.

You can sign in to Sandbox account separately from your App Store account since iOS 12. Sign in to sandbox here:


Purchasing process is the same as real in-app purchases. The only difference is accelerated time and impossibility to cancel subscription manually. Subscriptions in sandbox renew 6 times per day maximum.

Real duration

Duration in sandbox

1 week

3 minutes

1 month

5 minutes

2 months

10 minutes

3 months

15 minutes

6 months

30 minutes

1 year

1 hour

If after purchase in Apphud you can see a user with active subscription, it means that payment process work correctly.

Which Events Can Be Tested in Sandbox?

You can test following events in sandbox:

  • Trial Started

  • Trial Converted

  • Intro Started

  • Intro Converted

  • Intro Renewed

  • Intro Expired (if payment mode is "Pay as you go" and number of introductory periods is at least six)

  • Promo Started

  • Promo Converted

  • Promo Renewed

  • Promo Expired

  • Subscription Started

  • Subscription Renewed

  • Subscription Expired

  • Autorenew Disabled

  • Autorenew Enabled

You can read more about events here.