Our iOS App supports yearly subscriptions with different free trial periods. We are aiming to evaluate the receipts available locally on user's device offline.
**We are planning to do this: **
- Check if cancellation_date exists - inactive subscription
If cancellation_date doesn’t exist, check if purchase_date exists:
if yes, check if expires_date exists and is in an active period - active subscription
if not, check if expires_date exists and is in an active period - may be trial period
The thing we cant figure out is, if user turns-off subscription in trial period stopping payment, how can the app know such events?
Does expires_date indicate "trial duration + 1 Year" or only "1 year"?
Does original_purchase_date or purchase_date indicate "start of trial" or "the date user has made payment"?
Note: We also plan to periodically refresh local receipt using SKReceiptRefreshRequest.
Make sure you are looking at the sub-contents of all the
in_app
entries, ASN1 type 17. There will be one for each renewal.Cancellation date is only set if the subscription is cancelled by Apple customer service, you should mostly depend on the expiration date.
The trial is treated as separate in_app field in the in_apps array. So as long as you are looking for the latest
expires_date
field, you will be computing the correct expiration date.Also, I'm not sure how up to date the in_apps are when using
SKReceiptRefreshRequest
s. Apple says to use server side validation, and the /verifyReceipt endpoint when using subscriptions.Shameless plug, but if you are trying to implement subscriptions with less effort you might want to try my service, RevenueCat. We handle all the receipt parsing and tracking for you and do it correctly. You can sign up with my referral code.