How do I know when a subscription expires?

Hi,


I'm working with subscriptions.


How do I know when a subscription expires, or is cancelled by the user? Does Apple push this information to my app automatically, or do I have to execute a command such as SKReceiptRefreshRequest or restoreCompletedTransactions?


What is the difference between requesting a receipt refresh and restoring completed transactions?


Thanks,

Frank

Why is the transactionReceipt field of SKPaymentTransaction deprecated?


The In-App Purchase Programming Guide refers to this field: "Read the Original Purchase Date and Subscription Expiration Date field from each receipt entry to determine the start and end dates of the subscription."


I'm not seeing either field in the receipt, and since the receipt is deprecated I shouldn't be reading it anyway.


Perhaps the Programming Guide is referring to something else?

> How do I know when a subscription expires

You calculate the expiration date from the purchase date and the type of subscription.


>is cancelled by the user?

You can't. But cancellation is rare.


>Does Apple push this information to my app automatically,

Apple will push a renewal of an autorenewable subscription to your device.

>do I have to execute a command such as SKReceiptRefreshRequest or restoreCompletedTransactions?

It is best to infomr the user that it appears their subscription has expired and then do one of those 2 things to double check.


>What is the difference between requesting a receipt refresh and restoring completed transactions?

Very little. For an autorenewable subscription, the restoreCompletedTransactions will cause StoreKit to send future renewals to the device.

>Why is the transactionReceipt field of SKPaymentTransaction deprecated?

Because the receipt is now part of the app itself and is located here:

    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];   
    NSData *receiptData=[NSData dataWithContentsOfURL:receiptURL];



> The In-App Purchase Programming Guide refers to this field: "Read the Original Purchase Date and Subscription Expiration Date field from each receipt entry to determine the start and end dates of the subscription."

see:

https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html

How do I know when a subscription expires?
 
 
Q