Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS sandbox environment auto-renewal subscription

I have the following questions regarding iOS auto-renewable subscriptions

a) Are auto-renewal subscriptions really auto-renewing in the sandbox environment? The problem seems to be that subscriptions are not renewed automatically although the documentation says that even in sandbox environment it should happen 6 times.

b) Do we need to call restoreCompletedTransactions to get new receipt for automatically extended subscription, or is -paymentQueue:updatedTransactions: method called automatically by iOS? (I guess it automatically called on 'launch' & 'rotation out of background' not sure)

c) How have you handled the same subscription on multiple devices? This can be handled by restoreCompletedTransactions, but calling it will prompt users password, so it is not very handy to call it every time the app starts.

like image 622
2cupsOfTech Avatar asked Nov 07 '11 07:11

2cupsOfTech


People also ask

How do I check my sandbox subscription?

Once you have logged into a sandbox account using this method, you can then go to the Settings app, tap “iTunes & App Store”, then scroll to the bottom to the Sandbox Account section. Here you can log in and out of different sandbox accounts for testing.

Does Apple automatically renew Subscriptions?

They automatically renew at the end of their duration until the user chooses to cancel. Subscriptions are available on iOS, iPadOS, macOS, watchOS, and tvOS.


2 Answers

a) Auto-renewing subscriptions are inconsistent in the sandbox environment. Sometimes a subscription will renew multiple times (about 5) before ending. Other times it won't renew at all.

b) (iOS6 transaction receipts only) You don't need to call restoreCompletedTransactions to check the status of a subscription if you're storing previous receipts (preferably on your server). Just take any subscription receipt you've stored for that user and submit it to the App Store for verification. They'll respond with the latest_receipt_info including the expires_date which you can use to determine current subscription status.

c) You should prompt new users to "Restore Previous Purchases" at which point you call restoreCompletedTransactions. Then submit one of those receipts (preferably from your server) to the App Store for verification to get decoded details about the transaction. Look for the key original_transaction_id in the receipt info. This will always contain the id of the very first time this user initiated a subscription with you. If you compare this ID to others in your system, you should be able to determine which devices share an Apple account. (Since Apple doesn't allow you to see a user's Apple ID, this is the best way to identify an account that spans multiple devices).

Similar to this question: iOS auto-renew expired at the end of current subscription period

like image 72
Andrew Avatar answered Sep 27 '22 19:09

Andrew


To add to this it seems that the line in Apple's documentation is being misinterpreted

Renewal happens at an accelerated rate, and auto-renewable subscriptions renew a maximum of six times per day. This lets you test how your app handles a subscription renewal, a subscription lapse, and a subscription history that includes gaps.

This seems to mean that all subscriptions per day will only renew 6 times. Rather than each subscription will renew 6 times before canceling. This threw me for a while.

It also seems to be in a 24 hour period. Not refreshing at a given time. For example, I made a subscription at 11am that did not renew. I made one again at 2pm that renewed 6 times.

like image 24
AndyRyan Avatar answered Sep 27 '22 17:09

AndyRyan