如何获得不同的价格和货币信息的应用程序内购买? [英] How to get separate price and currency information for an in-app purchase?

查看:443
本文介绍了如何获得不同的价格和货币信息的应用程序内购买?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现应用内购买与几个国家支持的应用程序。

I am implementing in-app purchases for an app with support for several countries.

在应用内计费第3版API 声称,

The In-App Billing Version 3 API claims that:

没有货币转换或格式是必要的:价格报告   在用户的货币,并根据其区域设置格式化。

No currency conversion or formatting is necessary: prices are reported in the user's currency and formatted according to their locale.

这是其实真正,因为 skuGetDetails()采取一切必要的格式照顾。响应包括一个名为价格字段,其中包含

This is actually true, since skuGetDetails() takes care of all necessary formatting. The response includes a field called price, which contains the

格式化的项目价格,包括它的货币符号。价格不含税。

Formatted price of the item, including its currency sign. The price does not include tax.

不过,我需要的ISO 4217货币code(可回收,如果我知道这家店的语言环境)和实际非格式化的价格(最佳的浮点或十进制变量),所以我可以做进一步的处理和分析自己。

However, I need the ISO 4217 currency code (retrievable if I know the store locale) and the actual non-formatted price (optimally in a float or decimal variable) so I can do further processing and analysis myself.

解析返回skuGetDetails()不是一个可靠的想法,因为很多国家都有相同的货币符号。

Parsing the return of skuGetDetails() is not a reliable idea, because many countries share the same currency symbols.

我怎样才能得到一个应用程序内购买的应用内结算第3版API的ISO 4217货币code和非格式化的价格是多少?

How can I get the ISO 4217 currency code and non-formatted price of an in-app purchase with the In-App Billing Version 3 API?

推荐答案

的全部信息,可以发现的此处,但基本上是在2014年八月与解决:

Full information can be found here, but essentially in August 2014 this was resolved with:

的getSkuDetails()方法

这个方法返回产品标识列表的产品细节。在由谷歌播放发送的响应包,查询结果被存储在一个字符串的ArrayList映射到DETAILS_LIST键。在细节列表中的每个字符串中包含的产品细节JSON格式的单品。在JSON字符串与产品细节的领域总结如下

price_currency_ code ISO 4217货币code价格。例如,如果在英国的英镑被指定的价格,price_currency_ code是英镑。

price_currency_code ISO 4217 currency code for price. For example, if price is specified in British pounds sterling, price_currency_code is "GBP".

price_amount_micros 价格在微单元,其中百万微单位等于货币的一个单位。例如,如果价格是€七点九九,price_amount_micros是7990000。

price_amount_micros Price in micro-units, where 1,000,000 micro-units equal one unit of the currency. For example, if price is "€7.99", price_amount_micros is "7990000".

这篇关于如何获得不同的价格和货币信息的应用程序内购买?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆