Android 市场应用内购买:如何获取用户支付的货币?
我有一个使用应用内购买的 Android 应用程序,可以满足国际受众的需求,因此我希望以不同的货币进行付款。当然,我想显示用用户当地货币购买的物品,但我真的不知道如何做。
使用用户的区域或语言似乎是一个不好的指标,因为货币似乎取决于用户正在使用的市场帐户的区域,而不是设备设置。
我如何知道用户将使用哪种货币付款?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
从 IAB 版本 3 开始,可购买商品的 SKU 详细信息包括格式化的价格、其中包括用户支付的货币(Google Play 商店对应的货币):
编辑:我已更新了 SKU 详细信息表,现在包括以下信息: Price_currency_code 字段。
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):
Some examples of values of
price
(not from a real SKU):EDIT: I've updated the SKU details table, now including information about the price_currency_code field.
这有点困难,因为市场用于处理交易的汇率可能会在您显示价格和用户购买之间波动。我敢说 Google 希望您不要这样做,因为这可能会导致客户对他们/您大喊大叫,因为您说 10 美元,而他们被收取了 12 美元。
您最好的选择(没有人知道如何在框架内执行此操作)是询问用户他们希望以什么货币支付,然后给他们一个大概的价格(我会将其列在提供的价格旁边的括号中,例如“10 美元” [约 9 澳元]”)。您应该能够使用汇率 API 获取它。
这有点混乱,但您应该只需要询问一次并保存首选项。如果您确实想变得棘手,您可以使用粗略位置数据来获取其区域设置,并最初以这种方式填充值。
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.
我不认为这是一个好主意,因为应用程序内的计费不是由您处理的,而是由市场处理的。只需以美元或欧元写下价格,然后让用户在结账页面上以自己的货币查看购买情况即可。
http://developer.android.com/guide/market/billing/index.html
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
也许使用设备的默认区域设置?
String locale = Locale.getDefault().toString();
然后你可以对此进行比较。
只是一个想法!
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!