Search Unity

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

Discussion in 'Unity IAP' started by JonBFS, Jan 19, 2021.

Thread Status:
Not open for further replies.
  1. JonBFS

    JonBFS

    Joined:
    Feb 25, 2019
    Posts:
    39
    I want to get the expiration date for GooglePlay subscription purchases, but according to the docs, it says
    https://docs.unity3d.com/Manual/UnityIAPSubscriptionProducts.html


    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?

    https://android-developers.googleblog.com/2020/06/meet-google-play-billing-library.html
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    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?
     
    JonBFS likes this.
  3. unitydavi

    unitydavi

    Joined:
    Dec 23, 2021
    Posts:
    2
    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 .
     
  4. unitydavi

    unitydavi

    Joined:
    Dec 23, 2021
    Posts:
    2
    and the unity version i use is 2019.3.0f1
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Unity 2019.3 is no longer supported, please upgrade. And ensure to use IAP 4.1.3
     
  6. NoodlecakeStudios

    NoodlecakeStudios

    Joined:
    May 7, 2013
    Posts:
    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.
    Code (CSharp):
    1. var subscription = controller.products.WithID(GAME_SUBSCRIPTION);
    2. if (subscription.hasReceipt)
    3. {
    4.     var m = new SubscriptionManager(subscription, null);
    5.     var info = m.getSubscriptionInfo();
    6.     Debug.Log("[Noodle] Is Trial: " + info.isFreeTrial());
    7.     Debug.Log("[Noodle] Is Expired: " + info.isExpired());
    8.     Debug.Log("[Noodle] EXP Date: " + info.getExpireDate());
    9.     Debug.Log("[Noodle] purchase date: " + info.getPurchaseDate());
    10. }
    with the results being

    Code (CSharp):
    1. 05-11 09:18:39.612 17581 17604 I Unity   : [Noodle] IAP initialized
    2. 05-11 09:18:39.614 17581 17604 I Unity   : [Noodle] Is Trial: False
    3. 05-11 09:18:39.616 17581 17604 I Unity   : [Noodle] Is Expired: False
    4. 05-11 09:18:39.617 17581 17604 I Unity   : [Noodle] EXP Date: 5/11/2023 2:41:50 PM
    5. 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
    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.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @NoodlecakeStudios Please open a new thread for your topic, thank you for understanding. I'm locking this thread
     
Thread Status:
Not open for further replies.