Android Market In-App-Purchase: How to get the currency a user will pay in?

I have an Android app using In-App-Purchase that caters to an international audience, so I expect payments in different currencies. Of course I would like to show the items for purchase with the user’s local currency, but I don’t really know how.

Using the region or language of a user seems like a bad indicator, as the currency seems to depend on the region of the Market account the user is using and not on the device settings.

  • How to get application object into fragment class
  • Add abiFilters to gradle properties
  • Android: Playing an audio clip onClick
  • Android webcam enable in emulator
  • Set rowSpan or colSpan of a child of a GridLayout programmatically?
  • Android: Intent.EXTRA_ALLOW_MULTIPLE allows only single picking
  • How can I find out which currency a user will pay in?


    Related posts:

    Remove all items inside linearlayout
    How do I set multiple input types in an EditText on Android?
    I am looking for an api that provides lyrics for requested song
    How to scroll to top of long ScrollView layout?
    Alternative for AudioManager.setRingerMode() in Android 5.0 (API 21)
    Display the Contacts in sorting order ContactsContract.Contacts of Content Resolver
  • Is it possible to have icons on Action Bar Tabs for Android?
  • Share an image with a content provider in Android app
  • how to force language in android application
  • Android Fragments: When to use hide/show or add/remove/replace?
  • Android HttpClient, DefaultHttpClient, HttpPost
  • Android: Adb rejected connection to client
  • 5 Solutions collect form web for “Android Market In-App-Purchase: How to get the currency a user will pay in?”

    As of IAB Version 3, the SKU details for the purchasable item include a formatted price, which includes the currency the user would pay in (the corresponding currency to their Google Play store):

    enter image description here
    Some examples of values of price (not from a real SKU):

    • 3,99€
    • £2.99
    • $4.99

    EDIT: I’ve updated the SKU details table, now including information about the price_currency_code field.

    It is somewhat difficult to do as the exchange rate that the market uses to process the transaction may fluctuate between you displaying the price and the user purchasing. I daresay Google would prefer you weren’t doing this as it may result in customers yelling at them/you because you said $10 and they were charged $12.

    Your best bet (failing someone knowing how to do this within the framework) is to ask the user what currency they wish to pay in and then give them an approximate price (I would list it in brackets next to the supplied price like “USD$10 [approx AUD$9]”). You should be able to grab it using an exchange rate API.

    It’s a bit of messing around but you should only need to ask once and save the preference. If you really want to be tricky, you could use coarse location data to get their locale and initially populate the value that way.

    1. You may ask the user initially to choose their currency (optional).
    2. Show price in USD by default. Provide an option for user to change currency on item selection screen. Maybe an icon/button near to where price is displayed that opens a dropdown of all currencies. When user selects a currency from drop-down, all items’ price should be displayed in selected currency.

    I don’t that would such a good idea, since the the in app billing isn’t handled by your you, it’s handled by the market. Just write the price in dollar or euro and let the user see the purchase in their own currency on the check-out page.

    Perhaps use the default Locale of the device?

    String locale = Locale.getDefault().toString();

    Then you could do a comparison off of that.

    Just an idea!

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.