Newsstand based apps can offer iTunes purchases for subscriptions or single editions. To submit a Newsstand app, your app must offer at least one auto-renewable In-App Purchase subscription. For more info see Adding in app purchasing through iTunes
To integrate your in-app purchases with the app the individual product IDs and subscription product IDs in iTunes Connect (set up as in-app purchases for the app) must match the format in the app and CMS, and the secret key in the CMS must match iTunes Connect.
iTunes purchasing is tested in the sandbox environment (this prevents any actual payment taking place). To test these you will need to use testApple 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). Log in to iTunes Connect and click 'Manage Users' then 'Test User' to create test users - these can be used across different apps from same account. You should create at least one test account for each language that you provided localization information for.
You cannot test iTunes purchasing in the simulator, this needs to be tested on a physical device.
You cannot test iTunes purchasing if you are logged in on the test device with a valid iTunes account. First go to Settings > Store on the device to log out. (Note: Do not enter your test account information in the Store settings panel. Doing so may invalidate your test account.) Then go in to the app to test purchasing of single issues and subscriptions in sandbox mode. The app will prompt you to confirm and then login with a test user as your 'existing account' to do this.
Test both single issue and subscription purchasing works, and that these complete with no errors, and that downloads of entitled editions do not fail.
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 6 times. After the subscription has auto-renewed 6 times, it will no longer renew in the sandbox. The 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 Restore Purchases
- Make sandbox test purchase/s successfully (logging in as an iTunes Connect test user - make sure you've logged out of any real iTunes user account in device settings first)
- In the devices' Store Settings log out as the test 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 (i.e. the buttons should change from 'Buy' to 'Download')
- Then make sure you can download the already purchased edition/s
When you are finished testing iTunes purchasing, remember to log out in the device's settings.