StoreKit on iOS - autorenewable subscription - How to know whether it is a free trial or not?
Asked Answered
G

3

23

In iTunes Connect it is possible to give a free trial period for autorenewable subscriptions.

App > Manage In App Purchases > Subscription Basic > 1 Month >  Offer a free trial?

How can I get this information on the client? SKProduct does not have any information about this as I can see. Since we're having a marketing campaign it is very confusing for the end user to not see information about the product has a trial period.

Of course it is possible to fetch this kind of information from a server I maintain, but then we'll have the overhead with updating both our server and iTunes Connect. So I don't accept this kind of answer unless it is wired up to retrieving that trial period information from Apple's services.

Screenshot from iTunes Connect

Guff answered 4/6, 2013 at 8:22 Comment(3)
I guess you can have this information stored, you know that the particular product is available on trail basis so you can display this information to user while displaying product info.Sheers
I guess what you are suggesting, @NuzhatZari, is that I retreive information about trial period from a server I maintain, right?Guff
I am trying to create one with a free-trial period, but I don't see the "Offer a free trial" option - have Apple removed this feature?Gliadin
T
2

SKProduct > introductoryPrice

Available since iOS 11.2

https://developer.apple.com/documentation/storekit/skproduct/2936878-introductoryprice?language=objc

Tortoise answered 19/4, 2019 at 13:22 Comment(2)
does introductory price include free trials?Basilbasilar
Yes, it is. IntroductoryPrice contains enum SKProductDiscount.PaymentMod with 3 values: payAsYouGo, payUpFront and freeTrialHypercorrect
Y
9

TLDR; It is not possible. You need to manage this information yourself.


When you process an SKPayment you get back a receipt. You should verify those receipts regularly for subscriptions (e.g. before downloading new content) as the user might have cancelled the subscription. When the user does cancel the subscription or the subscription expires you get back a descriptive error when verifying the purchase's receipt.

Moreover the receipt gives you all the information you need: for a given product you know which trial period you grant. Therefore when a purchase is made you could store the purchase date given from the purchase receipt in your model object or in the NSUserDefaults or in the Keychain alongside the purchase data. At this point you know when the trial is expired and verify that the subscription is still valid. If you can't you might want to disable access to the content until you're able to do so.

For more informations about purchase receipts and subscriptions check out the In-App Purchase Guide by Apple.

Yelena answered 13/6, 2013 at 13:58 Comment(4)
Thanks for answering. The point is that before the user does any purchase I want to present to the user that there is an ongoing trial-period and the first month is for free. So the question is: how can I get information about the trial period from StoreKit or iTunesConnect? I want it to be dynamicGuff
Oh, I see. I didn't got what you meant. I'm not even sure if you can change the trial period once the item gets approved from the review team. Anyway, if you could, apparently there's no way to get that information at the moment. What you might do, though, is to work around this limitation by parsing the product description (if editable once the product is available to be purchased…) to check for a piece of string that tells you whether the item has a 7 or 30 days trial.Yelena
I suggest you file a radar to Apple. They might add that feature if they didn't yet with iOS 7.Yelena
It is possible to get information about trial period before purchase subscription (without SKPayment)?Amphibole
W
3

On the client side you usually identify the different products and characteristics by their product identifier as the App Store does not deliver certain information such as subscription period and free trial period.

So if your product ID is for example: com.domain.app.product_paid1month_free7days you split the ID on the client side and know that the paid subscription duration is 1 month and the product has a free trial period of 7 days.

Of course one approach would be to transmit the product ID to your own server to get its characteristics as response. This way you can maintain the product list continuously without updating the binary and across versions.

Westerman answered 15/10, 2017 at 8:49 Comment(0)
T
2

SKProduct > introductoryPrice

Available since iOS 11.2

https://developer.apple.com/documentation/storekit/skproduct/2936878-introductoryprice?language=objc

Tortoise answered 19/4, 2019 at 13:22 Comment(2)
does introductory price include free trials?Basilbasilar
Yes, it is. IntroductoryPrice contains enum SKProductDiscount.PaymentMod with 3 values: payAsYouGo, payUpFront and freeTrialHypercorrect

© 2022 - 2024 — McMap. All rights reserved.