Testing In-App Purchase Products

You can test your app and In-App Purchase products without creating financial transactions. That’s because Apple provides a test environment that uses the infrastructure of the App Store but that doesn’t process actual payments. Using iTunes Connect test user accounts, it instead returns transactions as if payments were processed successfully.

For more information about what tests to perform, see Suggested Testing Steps in In-App Purchase Programming Guide.

Testing Your App and In-App Purchase Products

Use a test user account when you test In-App Purchase products.

To perform testing for In-App Purchase products
  1. Set up test user accounts within Users and Roles in iTunes Connect, as detailed in Creating Sandbox Tester Accounts in iTunes Connect Developer Guide.

    You’ll need a test user for each territory you want to test the app in.

  2. Clear any account information stored on your test device.

    • In Settings, go to the Store settings.

    • Click the Sign Out button.

      This prevents an actual user account from automatically being used when testing.

  3. Connect your test device to your Mac.

  4. In Xcode, set your test device as your scheme’s destination.

  5. Open your app, and perform your In-App Purchase product testing.

  6. Use your test account credentials to test the purchase.

    When your app uses the Store Kit API to request a payment, you’re asked to sign in. Select Use Existing Account and enter your test account user name and password. You are then asked to confirm the purchase. The transaction completes.

    No financial transaction takes place, but a receipt is generated for a successful transaction.

Testing Auto-Renewable Subscriptions

When testing auto-renewable subscriptions in the test environment, keep in mind that the duration times are compressed. Additionally, test subscriptions only auto-renew a maximum of six times. Table 3-1 lists the compressed duration times.

Table 3-1  Subscription durations for testing

Actual duration

Test duration

1 week

3 minutes

1 month

5 minutes

2 months

10 minutes

3 months

15 minutes

6 months

30 minutes

1 year

1 hour