Testing grace period in auto renewal subscription in iOS - ios

I implemented auto renewing subscription in my app with grace period. I did code all the logics required to provide subscription service while the grace period but I could not find any way to test the grace period in Sandbox environment. Can someone help me with testing grace period feature in Sandbox environment.

I'm afraid it's impossible on iOS: you'll have to test it directly in production!
If you start implementing In-App Subscriptions on Google Play Store, it will be possible to test the grace period since you'll be able to change your payment method to the "Test card, always declines".

Enabling the billing grace period in App Store Connect doesn't change the expiration date corresponding to the grace period. But, it avoids revenue loss if Apple can recover the subscription within the grace period. See this graphic (explaining the renewal behavior without grace period) and this (explaining it with grace period). The difference is, that when Apple can renew the subscription within the grace period, the billing date doesn't change and therefore you do not lose revenue.
Source
Since the grace period doesn't change the expiration date, it is your responsibility to ensure that users can access the paid content after their subscription expired (when you have the grace period option enabled):
you’ll need to update your entitlement logic to ensure you are providing service to customers within the grace period
Source
Keeping that in mind, it is possible to test the grace period => grant access to your content after the subscription expired.
Unfortunately, without a server, you can't access a field telling you when the grace period ends. Therefore, you have to "calculate" it yourself corresponding to the subscription duration your user has. See this table showing the length of the grace period for each subscription duration.

Related

StoreKit2: does app need to do anything to support grace period?

I'm adding auto-renewable subscription support to my app. When I set grace period in App Store Connect, I see the following suggestion from Apple (emphasis is mine):
This will apply a grace period to all of your subscriptions. As the developer, you'll be required to continue to validate in-app transactions within the App Store and provide paid services to subscribers during this grace period. Learn More
I don't understand the emphasized part (I checked the linked doc but it doesn't say anything about it). My app doesn't involve server side service. The subscription is only to unlock advanced features. From my understanding, grace period is completely invisble to app code. Below are how I think it works in related scenarios:
Scenario 1) App Store fails to charge the user at the end of a subscription period and moves the subscription to "billing retry" state. In this case, the subscription's Transaction returned by Transaction.currentEntitlements has a nil revocationDate. So, from the app's perspective, user still has the subscription.
Scenario 2) App Store fails to charge the user at the end of the grace period (i.e. user doesn't resolve the billing issue). In this case, the subscription's Transaction returned by Transaction.currentEntitlements has a non-nil revocationDate. So, from the app's perspective, user's subscription is revoked.
In either case, app code doesn't see anything about grace period and needs to do nothing about it. Is my understanding correct?

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)

Setting expiry date for Non-Renewable subscription using storekit

I am writing a non-renewable subscription module for my new application. It includes 1 month, 3 month and 6 month subscription period. I do not understand, how to set expiry date using icloud. Any help would be appreciated?
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.
Subscription validity/expiry date 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.
"So if When you use iCloud for restoration you should have to manage expiry date on your own server..."
Non-renewable subscriptions. Subscriptions that don’t involve
delivering episodic content. Examples include access to a database of
historic photos or a collection of flight maps. It’s your app’s
responsibility to make the subscription available on all of the user’s
devices and to let users restore the purchase. This product type is
often used when your users already have an account on your server that
you can use to identify them when restoring content. Expiration and
the duration of the subscription are also left to your app (or your
server) to implement and enforce.
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Products.html
Hope it help you.

Decreasing price of in-app (iOS) auto renewal subscription

If I decrease the price of an in-app (iOS) auto renewal subscription would the existing subscriber continue to use service at discounted rate? Or would their auto renewal subscription get cancelled?
Quoting Apple docs : Link Here
When their subscription renewal date approaches, customers are notified if the price of an auto-renewable subscription has increased. After their subscriptions expire, they are opted-out of the subscription and must manually renew their subscription at the increased price.
If the price of an auto-renewable subscription decreases during the subscription period, customers are not notified and the subscription automatically renews at the lower price.
So it seems that if price goes down, the subscription is renewed at the reduced price, without notification.
Apple's docs ( https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html#//apple_ref/doc/uid/TP40008267-CH7-SW6 ) cover the case of a price increase. Since it does not explicitly cover the price decrease case, I would assume that the users will continue at the new, lower rate.
From "Expiration and Renewal" on that link:
Note: Increasing the price of a subscription doesn’t disable automatic renewal for all customers, only for those customers whose subscription expires in the next ten days. If this change is a mistake, changing it back to the original price means no additional users are affected. If this change is intentional, keeping the new higher price causes automatic renewal to be disabled for the rest of your users in turn as they enter the ten-day renewal window.
This is a (very) late response to the question but if anyone is looking for the updated docs and/or how to Manage pricing for auto-renewable subscriptions, here is the link for it.
Decreasing price is simple, auto renewal takes places as it would normally do.
Increasing however is a tad complicated than the prior, I'll just quote from the above link:
If you choose to increase the price of your auto-renewable
subscription, you have the option to preserve prices for existing
subscribers.
If you increase the price of a subscription without preserving prices,
all existing subscribers must consent to the new price before their
next renewal date. If they do not consent to the new price or take no
action, their subscription expires at the end of their current billing
cycle.
After your price increase goes into effect, Apple will automatically
inform existing subscribers through email and push notifications, and
attempt to obtain consent to the higher price. The timing of these
notifications depends on the length of the subscription, and there is
a minimum required notice. If a price increase occurs within the
minimum required notice period, subscribers will renew at their
existing price for one more billing period, and will be notified
before the end of their next billing period.

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