Search code examples
iosin-app-purchaseapp-storeapp-store-connect

How to know that trial is available in iOS app


We have "try for free" button in our app. I'd like to figure out how to know that trial is available.

I'm a little bit doubt about following text from documentation:

New and resubscribing customers are eligible to pay one discounted price or free trial per subscription group.

What is "resubscribing"? Can customers who has subscription in the past have trial again?

Is it possible to use StoreKit to figure out that trial is available now?

Is it correct to check introductoryPrice property of the SKProduct: https://developer.apple.com/documentation/storekit/skproduct/2936878-introductoryprice?

I also had an idea to ask backend for all the subscription history for current user and show "try for free" if user didn't have trial yet. But as I said I'm not sure about that "resubscribing".


Solution

  • The correct way to check for trial eligibility is to validate the receipt file as outlined by Apple below. Since most would consider this a non-critical validation, there isn't much harm in doing it client-side instead of off a server to save a network call. The worst harm a fake receipt could do is change the text of your button.

    Determine Eligibility

    To determine if a user is eligible for an introductory price, check their receipt: Validate the receipt as described in Validating Receipts With the App Store. In the receipt, check the values of the Subscription Trial Period and the Subscription Introductory Price Period for all in-app purchase transactions. If either of these fields are true for a given subscription, the user is not eligible for an introductory price on that subscription product or any other products within the same subscription group. You typically check the user's eligibility from your server. It's best to determine eligibility early—for example, on the first launch of the app, if possible.

    Based on the receipt, you will find that new and returning customers are eligible for introductory price or free trial discounts as follows: New subscribers are always eligible. Lapsed subscribers who renew are eligible if they haven't previously received an introductory price for the given product (or any product within the same subscription group).

    To answer your specific questions:

    Can customers who has subscription in the past have trial again?

    No. This is enforced by Apple for any products in the same subscription group. For example if user starts a trial for "Monthly Product", cancels, then later buys "Yearly Product" they won't be eligible for a free trial.

    Is it possible to use StoreKit to figure out that trial is available now? Is it correct to check introductoryPrice property of the SKProduct?

    No. The SKProduct will always show the same introductory price.