Testing Non-Consumable In-App Purchases

Introduction

An in-app purchase (or ‘IAP’) allows iOS developers to charge users for specific functionality or content while using an app.

Within iTunes Connect, the developer defines and sets up each IAP for an app. When the user makes an IAP purchase, the App Store handles the complex process of charging the user’s iTunes Account. IAPs can be defined for:

  1. Services
    • Messenger app subscriptions
  2. New functionality
    • Add removal
    • Game levels
  3. Content
    • Coins in a game
    • Digital books
  4. Subscriptions
    • Magazines
    • Periodicals

IAPs cannot be defined for:

  1. Physical goods
  2. Services or products for use outside of the app
  3. Expiring consumables (see below)
  4. Access to device hardware

There are various types of IAPs:

  1. Consumable
    • Delivered to the app and used up.
    • Not synchronized amongst a user’s devices and doesn’t need to be restored.
    • Examples:
      • Voice-Over IP minutes
      • Coins in a game
  2. Non-consumable
    • The user buys and has unlimited access forever.
    • Must be synchronized amongst a user’s devices because it needs to be restorable.
    • Examples:
      • Digital books
      • Add/remove functionality
  3. Non-renewing Subscription
    • Content or functionality is unlocked for a period of time.
    • Access is revoked at the end of the period.
  4. Auto-renewing Subscription
    • Content or functionality is unlocked for a period of time.
    • User is automatically billed at the end of the period and access to content or functionality continues.

Testing Non-Consumables

To test code associated with IAPs, a test user is set up in iTunes Connect to avoid actual monetary charges during testing.  The test user, referred to as a “Sandbox tester”, must be set up with a functioning email address since Apple sends a verification email to the address during set up.

Unfortunately, testing a new purchase of a non-consumable IAP requires a new Sandbox tester email each time. Repeated purchases using the same Sandbox tester email will be treated as restoring an item already purchased, so any code specific to new purchases will not be exercised. If multiple test runs through new purchase code are necessary and your email provider does not support qualifiers, then consider setting up a consumable IAP just for testing purposes. Delete the app on your device after each test and the purchase of a consumable IAP will be considered a new purchase.

Note: An example of an email qualifier is firstname.lastname+test1@gmail.com.  Emails sent to that address get delivered to firstname.lastname@gmail.com.

Happy testing!

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *