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

后端 未结 5 1537
鱼传尺愫
鱼传尺愫 2020-12-05 02:46

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

5条回答
  •  离开以前
    2020-12-05 03:15

    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.

提交回复
热议问题