Need to know when someone cancels a renewable subscription - ios

Good day,
Can someone please tell me how can I know track an event in my code/server when someone cancels a auto-renewable subscription from itunes/appleid
Thankyou

To check when someone cancels a renewable subscription, you need to periodically refresh the receipt on your server and check the:
Expiration Date (lets you know if subscription is still active)
Auto-renew status (lets you know if the user "cancelled")
Cancellation Date (tells you why subscription cancelled by support)
Usually developers get 2 and 3 confused. Apple doesn't consider a user opting out of auto-renew a "cancellation" - when in fact that's what most developers would consider a cancellation. For this reason, it's NOT sufficient to listen for CANCEL events with the subscription status notifications.
Here's a good blog post that goes over the details: iOS Subscriptions are Hard

Related

Apple Subscription - Detecting subscription cancelation state

We built an analytics system for our messaging using the IAP receipts Apple provides us and one use case for us is to be able to segment users with expired subscription.
While doing that we have discovered that some users have expiration_date in the past (usually only couple of hours ago) and auto_renew_status is "1" (true) but the is_in_billing_retry_period is "0". I couldn't find what this state means, does anyone have an idea of how to interpret this state?
The documentation says Apple is trying to bill the user 24hours prior the expiration date an if there's a billing error the user should get into is_in_billing_retry_period = "1".
is_in_billing_retry_period: "0" is an indicator for an expired subscription that Apple has stopped attempting to renew the subscription.
You should see an expiration_intent: 2 as well indicating the subscription expired due to a billing error.
source

Where Do I Find The Cancellation Date For In-App Subscriptions?

I'm finding it hard to retrieve a cancellation date (or check if someone's canceled at all) for an auto-renewable IAP subscription.
I'm doing receipt validation, but cancellation_date_ms never seems to be in the receipts response. I've tested this myself by creating a live subscription in production and canceling it myself, still no luck.
I've also tried using Apple's Subscription Status URL webhook, but they don't seem to send anything useful other than when somebody first subscribes or their subscription is renewed.
I'm running out of ideas!

Subscription status not called for auto renewable subscription in iOS

I am facing issues with my auto-renewing subscription for an iOS app that offers auto-renewable subscription.
The Subscription Status URL is at times, not being called when the subscription is renewed. This is making it difficult for us to track the user's subscription status. Funnily, this behaviour is completely arbitrary at times it is called and everything works smoothly, but at times it is not called at all.
Also, once the user's subscription is renewed, at times the user is not charged on his/her credit card instantly. Is this behaviour normal?
You have to follow basic rules for subscription based application.
Whenever you buy any auto renew subscription, in success verify your receipt and verify expiry date.
On every application launch very receipt and verify subscription. On depending result you can notify your server.
In sandbox environment for monthly subscription it will auto renew for every 5 mins. It will auto renew for 5 times. So you can check your test cases. After that it will be expire.
In real world case subscription will auto renew before 24 hours of renew date. So if user cancels subscription before that.
If you are using SwiftyStorekit than it will be very much easy for you to handle each and every steps. Let me know you if you want more coding approach in this case.I will share example code details if you want.
The Subscription Notifications are pretty unreliable and the descriptions of how they work aren't very clear. For example:
RENEWAL events aren’t sent when a subscription renews. ... RENEWAL
is sent when a subscription has expired, then later, the user starts
the subscription again.
CANCEL does not mean a user normally cancelled their subscription. It only is sent when a user cancels their subscription via customer
support. This is also known colloquially as a refund.
Source: RevenueCat (Disclaimer: I work there)

Handle Auto Renew Subscription iOS SDK

I am developing an app which requires auto renew subscription monthly and I want to maintain that on per user basis who logged into my app. is it possible anyhow with in app purchase. Also how can we handle cancelation of subscriptions ?
I want to maintain all this on my own server.
In the StoreKit documentation, it mentioned in Cancellation section:
A subscription is paid for in full when it’s purchased and can be
refunded only by contacting Apple customer service. For example, if
the user accidentally buys the wrong product, customer support can
cancel the subscription and issue a refund. It’s not possible for
customers to change their mind in the middle of a subscription period
and decide they don’t want to pay for the rest of the subscription.
To check whether a purchase has been canceled, look for the
Cancellation Date field in the receipt. If the field has a date in it,
regardless of the subscription’s expiration date, the purchase has
been canceled—treat a canceled receipt the same as if no purchase had
ever been made.
Depending on the type of product, you may be able to check only the
currently active subscription, or you may need to check all past
subscriptions. For example, a magazine app would need to check all
past subscriptions to determine which issues the user had access to.
Bear in mind that users can cancel the subscription anytime without opening your App. Therefore, you have to check the status of subscription every time the user logs into your App.

what happens on multiple purchase - Non-Renewal subscription in-app purchase

I am implementing a sample which includes the in-app purchase feature. The subscription is of non-renewal type.
In case of auto-renewal subscription, if the user has made a purchase, and within the validity period if the user retries to make the purchase, the iTunes shows the alert that
You are already subscribed to the purchase
and won't proceed further. The user can restore his subscription using the app restore feature.
But in case of non-renewal subscription type, if a user has made a purchase, and within the validity period if the user retries to make the purchase, the iTunes shows a confirmation alert that
You have already purchased the subscription, to renew or extend the
subscription press buy or press cancel
and if the user presses buy it proceeds further.
So, my doubt is what exactly happens in the later case (non-renewal repeated subscription).
Is the user again charged?
What happens with the user's subscription validity?
Can it be handled and controlled inside the code by me?
In case yes, any idea to proceed with would be highly appreciated and will be very helpful for me.
Thanks in Advance.
For Apple, there is no "within the validity period" for non-renewing subscriptions. The duration of the period, fortunately or unfortunately, is left up to the developer.
Yes, when the user buys a non-renewing subscription a second (or third, etc) time, the are charged again.
Subscription validity is up to the developer.
It seems common for developers to use their own server to track the expiry period of a non-renewing subscription. For example, this helps with the "restore" feature required by Apple.
You can alter the subscription start date from the day of repurchase of the APP. This will enable extended validity.
This validity extension mechanism also serves when the user realizes his subscription is about to expire and renews it before hand rather than letting the subscription end.
From the development perspective, logging the first subscribed time along with the current sub and expire time would serve the purpose.
Yes i am altering the subscription start date obviously, and i am getting this from the transaction. According to this subscription start date i am altering the expiry date as well.
The concern here is to avoid the user from getting charged again in any case if he has already subscribed. And, for that i am using iCloud to support restore functionality in user's multiple devices.

Resources