Manage purchase cancellation with Grand Unified Receipt (iOS 7+)

Guys I need your help to understand how to properly manage the cancellation of a purchase on iOS 7+ (with Grand Unified Receipt). The cancellation happens when "a customer contacts Apple customer support for a refund". Apple says that we should rely on the cancellation_date field in order to understand whether a purchase is cancelled: "If your app validates its receipt with the App Store and your subscriptions are still valid, then cancellation_date will appear in the latest_receipt section of the returned receipt. If your subscriptions are expired, cancellation_date will appear in its latest_receipt_info section." (https://developer.apple.com/library/content/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-RECEIPT-HOW_DO_I_USE_THE_CANCELLATION_DATE_FIELD_) The problem is that the latest_receipt and latest_receipt_info are returned only for iOS 6 (or less) using the old receipt style: "Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions." (https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html).

I found a discussion here on the forum that says: "But if you have a new receipt (iOS7 and later - from [[NSBundle mainBundle] appStoreReceiptURL]) then Apple servers do not update that receipt, they just decode it. So if a user makes a purchase then their receipt will not have a cancellation_date in it. If they subsequently cancel the purchase then their old receipts will not magically transform. You will need to refersh their receipt to discover whether or not there is a cancellation_date." (https://forums.developer.apple.com/message/136585#136585).

So, the answer to my question should be that I have to refresh the receipt to see if, after the refresh, it contains the cancellation_date. But Apple, again, says that "Restoring purchases prompts for the user’s App Store credentials, which interrupts the flow of your app: because of this, don’t automatically restore purchases, especially not every time your app is launched." (https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html). So, I can't seem to automatically refresh the receipt.

What's the solution to this issue, then? Thank you.

You raise a good point. I don't believe Apple sends out a new transaction when a user cancels the subscription so the only time you would detect it is at the next renewal period. Submit a bug report.


But a cancellation is quite rare.

Thank you PBK, I'll submit a bug report to solve this issue.

Manage purchase cancellation with Grand Unified Receipt (iOS 7+)
 
 
Q