Auto-renewable subscriptions: 'is_in_intro_offer_period' in the local receipt with free trial period

Hi,


In short:

1. Is the 'is_in_intro_offer_period' field in the local receipt will be 'true' if the subscription is in the trial period?

2. What is the right way to define from local receipt (not using server and verifyEndpoint) if user has used trial period for a subscription group?


More detailed:

We use auto-renewable subscriptions in the app. It's required to define if user is eligible for a free trial or introductory price to display correct price in the app. It seems that it's possible with the help of 'is_in_intro_offer_period'field from local receipt (Receipt Fields documentation, is_in_inrto_offer_period documentation). 'Trial' is one of the Intro Offer Period types ("The offer types are “pay as you go”, “pay up front”, and “free trial”" from documentation), so it's expected that the 'is_in_intro_offer_period' field will be 'true' if subscription is in the trial period. All our tests showed that both local and remote receipts for subscriptions in the trial period always contain "false" in the "is_in_intro_offer_period" field.


The first question is why the 'is_in_intro_offer_period' field is not 'true' when the subscription is in the trial period? Does it mean that 'is_in_intro_offer_period' relates just to the 'Pay As You Go' and 'Pay Up Front' offer types? If so, it should be mentioned in the documentation.


We've planned to use 'is_in_intro_offer_period' from local receipt to define if user is eligible for a free trial price. But:

1) the 'is_in_intro_offer_period' field is not 'true' when subscription is in the trial period (as written in the first question)

2) the 'is_trial_period' field is not presented in the local receipt

So the second question is how to define if a user is eligible for a free trial using just local receipt? (I understand that it's possible to use the 'is_trial_period' field from the 'verifyEndpoint' JSON, but the question is if it's possible to do it locally)


Here is an example of JSON from verifyEndpoint for real subscription that is in the trial period with "is_in_intro_offer_period": "false".

{
    "auto_renew_status": 1,
    "status": 0,
    "auto_renew_product_id": "com.companyName.subscription.onemonth1",
    "receipt": {
        .....
    },
    "latest_receipt_info": {
       "is_in_intro_offer_period": "false",
        "is_trial_period": "true",
        "product_id": "com.companyName.subscription.onemonth1",
        "subscription_group_identifier": "20483890",
        "quantity": "1",
        "web_order_line_item_id": "430000223503827",
        "transaction_id": "430000604899999",
        "purchase_date_ms": "1584597149000",
        "purchase_date_pst": "2020-03-18 22:52:29 America/Los_Angeles",
        "purchase_date": "2020-03-19 05:52:29 Etc/GMT",
        "expires_date": "1584856349000",
        "expires_date_formatted": "2020-03-22 05:52:29 Etc/GMT",
        "expires_date_formatted_pst": "2020-03-21 22:52:29 America/Los_Angeles",
        "original_transaction_id": "430000604899999",
        "original_purchase_date_ms": "1584597149000",
        "original_purchase_date_pst": "2020-03-18 22:52:29 America/Los_Angeles",
        "original_purchase_date": "2020-03-19 05:52:29 Etc/GMT",
        "unique_vendor_identifier": "AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE",
        "unique_identifier": "aaaaaaaaaaaaaa5aaeaeeaddaafaaaaaaaaceaaa",
        "bvrs": "395",
        "bid": "com.companyName.appName",
        "item_id": "1439222222",
        "app_item_id": "123456789"
    },
    "latest_receipt": "e.....="
}
Post not yet marked as solved Up vote post of karina1 Down vote post of karina1
1.2k views

Replies

Did you ever find a solution to this? I'm having the same issue

I've noticed this as well just now.

is_in_intro_offer_period is not work anymore and the verifyReceipt endpoint is also deprecated.

https://developer.apple.com/documentation/appstorereceipts/requestbody

and,

If you need to determine whether the current subscription is within the free trial period,

you can call check if (expires_date_ms - purchase_date_ms) is less than the specified period.

https://developer.apple.com/documentation/appstoreserverapi/jwstransactiondecodedpayload

let purchase_date_ms =  parseInt(latest_transcation.purchaseDate)
let expires_date_ms =  parseInt(latest_transcation.expiresDate)
let duration =  expires_date_ms - purchase_date_ms
var isInIntroOfferPeriod = false
// free period in your introoffer
// for example: 3 days free trial in my yearly subscription 
if (duration > 0 && duration <= 3*86400000) {
		isInIntroOfferPeriod = true
}