4

Is there any way to convert a currency symbol to the corresponding ISO code in Java/Android?

I have seen that Google Play in-app billing APIv3 can send us the item price including the currency symbol, but then we are storing the price and currency in different fields, so we can validate if the payment has a valid currency.

I know that I can iterate all the locales and compare the currency Symbols, but I think there must be a easier way to do this task.

Thanks a lot!

// Edited 1/11/2013

I have just realized that it's impossible covert the currency symbol to its currency code, because there are many countries which share the same symbol.

Maybe the correct question is how can I know how much money and in what currency has paid a user??

Acampoh
  • 589
  • 1
  • 8
  • 23
  • by iso code you mean which iso ? the country code ? – njzk2 Jan 10 '13 at 17:01
  • I mean currency ISO code (ISO 4217) it's a 3 letter code with the name of the currency for example: € -> EUR or $ -> USD. – Acampoh Jan 11 '13 at 08:21
  • You can get currency (code and sign) from IAP billing service. What else do you need? (another format?) Please refer: https://stackoverflow.com/questions/9402172/android-market-in-app-purchase-how-to-get-the-currency-a-user-will-pay-in https://stackoverflow.com/questions/17039119/how-to-get-separate-price-and-currency-information-for-an-in-app-purchase and of course https://developer.android.com/google/play/billing/billing_reference.html#getSkuDetails – Yaroslav Havrylovych Oct 01 '17 at 14:02

0 Answers0