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

5

34

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 can I find out which currency a user will pay in?

Thanks.

Flair answered 22/2, 2012 at 20:9 Comment(1)
Having the same issue/need. We want to be able to show the in app items their price.Woolly
B
26

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.

Blinnie answered 1/8, 2014 at 9:7 Comment(5)
Jippieh! Do you know when IAB v3 went into effect?Flair
TBH, I don't know :) I'm glad this solves your solution. However, imho, the solution the Android team has provided is far from ideal: they provide a formatted string and, separately, a currencyCode field containing the ISO code of the currency (e.g. USD, AUD, EUR). I don't know why they don't provide a proper Locale. Besides, the IAB v3 documentation is not updated with these new fields! Have a look at the related issue to see its progressSelfregulating
As of 27/10/2014, they have updated the IAB v3 documentation to include information about the price_currency_code field. I've updated the answer accordinglySelfregulating
The price and price_currency_code values are not necessarily the values the user will actually see in the final payment dialog! Example: the item's default currency is JPY and the user's store is the Japan store; then the SKU info will be in JPY, but the user's credit card may be denominated in USD, in which case the final payment amount shown by the Google Play dialog is in USD.Langlauf
That's right,but we need to display the price of our items if user has wish to see price before the purchase.It's not necessary but important.Rafflesia
D
5

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.

Dafna answered 3/3, 2012 at 4:52 Comment(3)
This would be the case for iOS but in the play console you have the option to set the price per currency. So the price shouldn't fluctuate at all unless I'm missing something.Rodolforodolph
@Rodolforodolph I was specifically talking about the Play Store at the time. No idea on iOS personally. Having another look, there is the option of defining the price for most countries, but not all. The remainder would be charged at USD conversion from memory, which would almost certainly fluctuate.Dafna
What countries can the app be sold for which you cannot set the price for? AFAIK you enable the countries you want to sell in and then always*? have the option to set the price.Rodolforodolph
A
4
  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.
Aston answered 3/3, 2012 at 13:34 Comment(0)
H
3

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.

http://developer.android.com/guide/market/billing/index.html

Hydranth answered 22/2, 2012 at 20:35 Comment(2)
Well, I don't think displaying to different prices is a good idea. I found nothing in the Android documentation at all on the i18n problems with billing.Flair
I agree that letting the user choose a currency that Google Play is just going to ignore is a bad idea. The biggest problem with the Google Play checkout at the moment is it's not telling me what currency the price is in. It just shows a currency symbol. So if my app just shows the USD price with a "local pricing will be shown at checkout" message, when they go to the checkout if their currency is also shown with $ sign they have no idea if I'm trying to pull a fast one and charge them more or if it's just showing the local $'s price. (Example: NZ $ are worth less than USD).Matildematin
A
-2

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!

Adsorbent answered 22/2, 2012 at 20:39 Comment(2)
That's what I meant with "region or language of a user seems like a bad indicator". It will be correct in many cases, but the payment currency is not tied to the device, but to the Market account (I think). If I change my language, I still pay in EUR because I'm from Germany and Google knows that.Flair
@JanP.: I am looking for a way out where I can get the price which I paid in Google wallet.If you have any inputs , please share .That would really help.Quintie

© 2022 - 2025 — McMap. All rights reserved.