Search Unity

How to get subscription duration or billing period information on iOS and Android?

Discussion in 'Unity IAP' started by hippo_san, Apr 4, 2019.

  1. hippo_san

    hippo_san

    Joined:
    Oct 29, 2014
    Posts:
    23
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    There is a Google extension that you can use that returns data in the form:

    {"productId":"sub3","type":"subs","price":"$1.99","price_amount_micros":1990000,"price_currency_code":"USD","subscriptionPeriod":"P1W","freeTrialPeriod":"P3D","introductoryPriceAmountMicros":990000,"introductoryPricePeriod":"P1W3D","introductoryPrice":"$0.99","introductoryPriceCycles":1,"title":"sub3 (demo6)","description":"sub3"}

    private IGooglePlayStoreExtensions m_GooglePlayStoreExtensions = extensions.GetExtension<IGooglePlayStoreExtensions>();
    Dictionary<string, string> productJSONDetails = m_GooglePlayStoreExtensions.GetProductJSONDictionary();

    The ProductJSONDetails is a dictionary where the key is product id and the value is the product's JSON detail which is retrieved from the Google Play store (which does not need to have a receipt, all the valid products that configured in the UnityIAP will have this information.)
     
  3. hippo_san

    hippo_san

    Joined:
    Oct 29, 2014
    Posts:
    23
    Thanks for the reply. How can I get this information for iOS products? (I don't have the introductory price set in app store connect).
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    In IAP 1.22, the following code should work:

    Dictionary<string, string> introductory_info_dict = m_AppleExtensions.GetIntroductoryPriceDictionary();
    Dictionary<string, string> product_details = m_AppleExtensions.GetProductDetails();
     
  5. hippo_san

    hippo_san

    Joined:
    Oct 29, 2014
    Posts:
    23
    Thanks for this! By the way would it be good if this information comes with
    UnityEngine.Purchasing.Product?
     
    ProGameDevUser and korimako like this.
  6. piyushpandeyDrpanda

    piyushpandeyDrpanda

    Joined:
    Dec 17, 2018
    Posts:
    9
    Hi @JeffDUnity3D
    We are trying to implement Amazon subscription from Unity IAP plugin 1.23.0 in our Unity Game. We want to get the duration of our products of Amazon. But unlike Google and iOS platform where we have methods like
    Code (CSharp):
    1. Dictionary<string, string> introductory_info_dict = m_AppleExtensions.GetIntroductoryPriceDictionary();
    2. Dictionary<string, string> product_details = m_AppleExtensions.GetProductDetails();
    we do not have any method in Amazon in the
    IAmazonExtensions
    interface to get that information.
    The interface looks like this :
    Code (CSharp):
    1. public interface IAmazonExtensions : IStoreExtension
    2.   {
    3.     string amazonUserId { get; }
    4.  
    5.     void NotifyUnableToFulfillUnavailableProduct(string transactionID);
    6.   }
    Is there any way to get the product details in Amazon?