How to restore and verify auto-renewable subscriptions?
<p>First off there seem to be many questions on SO regarding this topic but most seem outdated and not considering APIs that are available in iOS 9.</p>
<h3>1) How are purchases restored?</h3>
<p>When a user taps the <code>Restore Purchase</code> button for auto-renewable subscriptions on &gt;=iOS 9, should a <code>SKReceiptRefreshRequest</code> or <code>SKPaymentQueue.defaultQueue().restoreCompletedTransactions()</code> be called? Currently I verify the receipt file to determine the active subscription and parse for the <code>latest_receipt_info</code>, is a receipt file also created on the device when <code>restoreCompletedTransactions</code> is called?</p>
<h3>2) How can an auto-renewable subscription be verified?</h3>
<p>To verify that an auto-renewable subscription on &gt;= iOS 9 is still active and not cancelled I would call <code>SKReceiptRefreshRequest</code> every time the user launches the app. But the <a href="https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html" rel="nofollow noreferrer">docs</a> say:</p>
<blockquote>
<p>Include some mechanism in your app to let the user restore their
purchases, such as a Restore Purchases button. Restoring purchases
prompts for the user’s App Store credentials, which interrupts the
flow of your app: because of this, <strong>don’t automatically restore
purchases, especially not every time your app is launched</strong>.</p>
</blockquote>
<p>Should I call it only once a day or is there another way to verify the subscription?</p>
<h3>Update:</h3>
<p>For 2) just found this <a href="https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateLocally.html#//apple_ref/doc/uid/TP40010573-CH1-SW9" rel="nofollow noreferrer">here</a>:</p>
<blockquote>
<p>Perform receipt validation immediately after your app is launched,
before displaying any user interface or spawning any child processes.
Implement this check in the main function, before the
NSApplicationMain function is called. For additional security, you may
repeat this check periodically while your application is running.</p>
</blockquote>
<p>Apparently the receipt can be validated without user interaction. It is even recommended to do it on one's own server for security purpose. So as long as the receipt is validated by the App Store server there is no need for a receipt refresh request.</p>