search by tags

for the user

adventures into the land of the command line

testing apple auto renewable subscriptions

ugh it's just the worst thing ever..

first

here's a bunch of links to stuff that helped:

1, 2, 3, 4, 5, 6, 7, 8, 9

second

here's a bunch of stuff to remember about the apple sandbox test environment that isn't written down anywhere or if it is, it's not clear:

- The behavior of auto-renewable subscriptions differs between the testing environment and the production environment.
- In the testing environment, subscription renewals happen at an accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day per sandbox test account.
- This will refresh after 8 hours, or you can use another test account.
- This enables you to test how your app handles a subscription renewal, a subscription lapse, and a subscription history that includes gaps.
- See Testing Auto-Renewable Subscriptions in the In-App Purchase Configuration Guide for iTunes Connect to learn about the subscription durations for testing.
- Because of the accelerated expiration and renewal rates, a subscription can expire before the system tries to renew the subscription, leaving a small lapse in the subscription period.
- Such lapses are also possible in production for a variety of reasons, so make sure your app handles them correctly.

sandbox subscription renewal times:

1 week -> 3 minutes
1 month -> 5 minutes
2 months -> 10 minutes
3 months -> 15 minutes
6 months -> 30 minutes
1 year -> 1 hour

third

here's a bunch of stuff to remember about when receipts are issued:

- A receipt is created and signed by Apple through the App Store.
- A receipt is issued for a specific version of an application and a specific device.
- A receipt is stored locally on the device.
- A receipt is issued each time an installation or an update occurs.
- When an application is installed, a receipt that matches the application and the device is issued.
- When an application is updated, a receipt that matches the new version of the application is issued.
- A receipt is issued each time a transaction occurs:
- When an in-app purchase occurs, a receipt is issued so that it can be accessed to verify that purchase.
- When previous transactions are restored, a receipt is issued so that it can be accessed to verify those purchases.
- Exceptions for the sandbox environment for auto renewing subs:
- 1. Auto-renewable subscriptions renew a maximum of 6 times per day, per test account.
- 2. This will refresh after 8 hours, or you can use another test account.

fourth

some things to remember about actually testing on a device:

- you can't use the simulator, you have to use a real device.
- if you want to use a sandbox user, you need to log out of your real user (if you are using your own phone), and log in with one of your sandbox users when your test purchase prompts you to use "an existing apple id". don't try to login in the settings.
- when you make test purchases in your app, you may get multiple prompts that won't happen in production, also it might intermittently take ages.
- you will start to get annoying login popup reminders that look like this:


fifth

some test scenarios:

Testing renewals and expiration:

1. Subscribe to a monthly subscription
2. Close the app and set a 5 minute timer
3. Launch the app
4. If prompt is displayed, enter password

At this point the app should continue to operate in the subscribed state. Repeat steps 2-4 several more times (or just close the app and wait) until 35 minutes has passed (6 renewals at 5 minutes each plus the original 5 minute subscription). The app should now revert to the un-subscribed state and allow the user to re-subscribe.

Test restoring purchases after expiration:

1. Subscribe to a monthly subscription
2. Close the app and wait 35 minutes
3. Launch the app
4. If prompt is displayed, enter password
[app should revert to the un-subscribed state]
5. Tap “Restore Purchases” button

No active subscription should be found and the user should be shown a message to that effect.

Test restoring purchases during active subscription:

1. Subscribe to a monthly subscription
2. Delete app and reinstall within 5 minutes
3. Launch the app
4. Tap “Restore Purchases” button

Active subscription should be found and the app should change to the subscribed state.

Test restoring purchases across devices:

1. Subscribe to a monthly subscription
2. Install the app on a different device before the subscription expires
3. Launch the app
4. Tap “Restore Purchases” button

Active subscription should be found and the app should change to the subscribed state.

sixth

some things to remember about the review process:

apple will do the review against their sandbox, but your production environment.
apple will release to their production environment and your production environment.

sentences you need to include in the app and make sure are clearly visible to the user:

Payment will be charged to your iTunes account at confirmation of purchase.
Your subscription will automatically renew unless auto-renew is turned off at least 24-hours before the end of the current subscription period.
Your account will be charged for renewal within 24-hours prior to the end of the current subscription period. Automatic renewals will cost the same price you were originally charged for the subscription.
You can manage your subscriptions and turn off auto-renewal by going to your Account Settings on the App Store after purchase.
Read our Terms of Service and Privacy Policy for more information.