Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

IAP metadata.localizedPrice not working for Asian currency

Discussion in 'Unity IAP' started by Aladine, Apr 15, 2018.

  1. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    138
    Hello,

    I have this line of code which works perfectly in western stores :

    Code (CSharp):
    1. buyButtonText.text = _myIAP.m_StoreController.products.WithID(_myIAP.charsIDs[scrollPage]).metadata.localizedPrice.ToString();
    it shows the right price with the right currency symbol (€, $, etc..) on Western stores, however on the Japanese google store it doesn't, and we are scheduled for a feature on Google Play in there, and had this issue specifically requested to fix by google.

    is this a known issue ?

    thanks
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    5,449
    Did Google confirm the issue?
     
  3. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    138
    Sorry, the confusion was in our side...
    metadata.localizedPrice waw working properly (giving the right price on that store).
    what i should use instead is metadata.isoCurrencyCode then all i had to do is create this array :

    Code (CSharp):
    1. { "USD", "$ " },
    2. { "EUR", "€ " },
    3. { "GBP", "£ " },
    4. { "CNY", "¥ " },
    5. { "HKD", "$ " },
    6. { "JPY", "¥ " },
    7. { "MOP", "$ " },
    8. { "SGD", "$ " },
    9. { "KRW", "₩ " },
    10.  
    and based on the returned value from metadata.isoCurrencyCode i just chose the proper symbol from the array.

    sorry again :)
     
  4. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,282
    use metadata.localizedPriceString, that includes the currency symbol.
     
    Aladine likes this.
  5. Aladine

    Aladine

    Joined:
    Jul 31, 2013
    Posts:
    138
    oh really :O
    thanks!