What version of Android in-app billing API am i using?

I want to get the expiration date for GooglePlay subscription purchases, but according to the docs, it says

I checked the library and the most recent version isn’t even 5 yet. Am I looking at a different library that what is mentioned in the docs? Which Android in-app billing API version am I using with Unity 2019.4.17?

You can safely ignore the version 6 mention, that was an older naming convention. We are now using Google Billing library v3. You should be able to get the expiration date, is it working in your testing?

1 Like

hi,i also want to get isFreeTrial(); ,but according to the document :
"Returns a Result enum to indicate whether this Product is a free trial.

  • Products in the Google Play store return Result.Unsupported if the application does not support version 6+ of the Android in-app billing API.
    Non-renewable Products in the Apple store return a Result.Unsupported value. Auto-renewable Products in the Apple store and subscription products in the Google Play store return a Result.True or Result.False value."

and i test it too .also return me Unsupport on android. pls tell me how to fix it .

and the unity version i use is 2019.3.0f1

Unity 2019.3 is no longer supported, please upgrade. And ensure to use IAP 4.1.3

I am currently on Unity 2021.2.15f1 and have installed Unity In-App Purchasing 4.1.4, and subscriptions seem to always be returning false for isFreeTrial.

var subscription = controller.products.WithID(GAME_SUBSCRIPTION);
if (subscription.hasReceipt)
{
    var m = new SubscriptionManager(subscription, null);
    var info = m.getSubscriptionInfo();
    Debug.Log("[Noodle] Is Trial: " + info.isFreeTrial());
    Debug.Log("[Noodle] Is Expired: " + info.isExpired());
    Debug.Log("[Noodle] EXP Date: " + info.getExpireDate());
    Debug.Log("[Noodle] purchase date: " + info.getPurchaseDate());
}

with the results being

05-11 09:18:39.612 17581 17604 I Unity   : [Noodle] IAP initialized
05-11 09:18:39.614 17581 17604 I Unity   : [Noodle] Is Trial: False
05-11 09:18:39.616 17581 17604 I Unity   : [Noodle] Is Expired: False
05-11 09:18:39.617 17581 17604 I Unity   : [Noodle] EXP Date: 5/11/2023 2:41:50 PM
05-11 09:18:39.618 17581 17604 I Unity   : [Noodle] purchase date: 5/11/2022 2:41:50 PM

Here is my subscription setup on googles end
8119880--1052324--upload_2022-5-11_9-27-39.png

Any direction would be great. I am leaning toward using cloud save to store the purchase date and just calculating remaining in game trial time based off of that date if this function never works.

@NoodlecakeStudios Please open a new thread for your topic, thank you for understanding. I’m locking this thread