tikhop / TPInAppReceipt

Reading and Validating In App Purchase Receipt Locally.
MIT License
631 stars 93 forks source link

Auto renewable subscription is user-cancelled (not support-cancelled?) #92

Closed nneubauer closed 2 years ago

nneubauer commented 2 years ago

Hi,

first of all -- thanks for making this library!

I a wondering if it is possible at the moment (probably not, then consider it a feature request) to determine for an auto renewable subscription if the customer has an active "auto renewal" or if they canceled the auto-renewal. In other words, their current subscription will still not be "expired" until the end of the current period, but after that, they have basically "quit".

There is a stack overflow question/answer about it here, but I'd love to have this functionality available in TPInAppReceipt.

https://stackoverflow.com/a/54473720/1138434

Thanks!

nneubauer commented 2 years ago

I am not sure what cancellationDate does. It seems in Apple's docs a cancellation is related to user-refunds and so am I interpreting that hasActiveAutoRenewableSubscription immediately returns false if this is present. Can you confirm that cancellationDate is not nil, if and only if there was a refund?

During testing, it seems that this is nil also on non-subscription IAPs like the docs say, but is it because you have not implemented refund testing or are there different semantics for the field?

tikhop commented 2 years ago

Hi @nneubauer, I'm sorry for the delay.

Based on docs cancellationDate is not nil when transaction was canceled by Apple customer support or auto-renewable subscription plan was upgraded.

Unfortunately, we can't check the current renewal status for the auto-renewable subscription because it's only presented when validating with the App Store, in the JSON form of the receipt.

nneubauer commented 2 years ago

Thanks for your reply, I am still not sure about how to use it as the documentation of TPInAppReceipt says

Cancellation Date. Returns nil if the purchase is not a renewable subscription

Is that wrong then? Maybe -- if this is correct -- you might want to change it to

Cancellation Date. Returns a value if the transaction was refunded by customer support or the auto-renewable subscription plan was upgraded. Otherwise returns nil.

For my original question. That is unfortunate but if not possible, thanks for letting me know.

tikhop commented 2 years ago

Thanks for making a point, I agree and going to change it.