Testing iOS iTunes App Store Purchases
Table of Contents
Testing iOS store purchasing
Bolt apps can offer iTunes (App Store) purchases for subscriptions and single issues.
Sandbox purchasing
iTunes purchasing can be tested in the sandbox environment (this prevents any actual payment taking place) with development or ad hoc signed builds. See Apple's documentation on Testing in-app purchases with sandbox for more information. To test these you will need to use test Apple ID accounts (note: you cannot create a test user with the same email address as an actual user, including ‘tester’ or similar in the account name is good practice to avoid confusion). See Apple's Create Sandbox Apple IDs documentation for instructions on how to create such users. Note that such test users can be used across different apps from the same account. Apple recommends that you create at least one test account for each language that you provided localisation information for.
Go into the app to test purchasing of single issues and subscriptions in sandbox mode. The app will prompt you to confirm and then log in with a test user to do this. iOS now supports a 'sandbox account' setting in the device settings, separate to the real Apple ID setting.
You should test that both single issue and subscription purchasing works (where both are supported), and that these complete with no errors, and that access to entitled collections does not fail.
Sandbox subscription durations
Note: when testing auto-renewable in-app purchase subscriptions in the sandbox environment, the duration times will be compressed to allow for more streamlined testing. Additionally, a sandbox subscription will only auto-renew a maximum of 12 times. After the subscription has auto-renewed its maximum, it will no longer renew in the sandbox. The default compressed duration times are as follows:
Actual duration | Sandbox 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 |
Testing successful restore purchases (sandbox)
- Make sandbox test purchase/s successfully
- In the devices' Store Settings log out as the test sandbox user
- Delete the app from the device and run/sideload onto the device again, or use a different device
- Press the restore purchases button in the app settings - you should be prompted to log in again
- Any previously made purchases as the same test user should be restored
- Then make sure you can access what was previously purchased
Sandbox receipts
Note that sandbox receipts work a little differently to production (and sandbox production) receipts, meaning that verify will not be called initially, so that a restore purchases action will have to be manually done in order to get a receipt at all (this might be relevant if you want to check the attached receipt, for example).
TestFlight
App-store signed builds can be used to test purchasing via TestFlight. See Apple's Testing Apps With TestFlight doc for (some) more information. This uses neither the sandbox nor production environments, but a secret third thing (sandbox production environment). This means that in-app purchases made during TestFlight beta testing will not carry over to real App Store versions of the app. It also does not take any real payments.
The production sandbox (TestFlight) environment also uses compressed subscription durations.
Please note that Testflight cannot be used with managed Apple IDs.
More information
See Apple's In-app purchase landing page which links out to further documentation on the subject.