gpt4 book ai didi

android - 应用内结算库存价格并不总是与用户打算购买时显示的货币相同

转载 作者:太空狗 更新时间:2023-10-29 14:12:04 25 4
gpt4 key购买 nike

我的 Android 应用程序正在使用应用程序内购买/应用程序内结算,到目前为止整个过程运行良好。我遇到的唯一问题是有时货币会在此过程中发生变化。我的意思是,当我使用 mHelper.queryInventoryAsync() 查询库存时获得的价格/货币有时与用户单击要购买的商品时显示的价格/货币不同.

例如,有一位来自希腊的用户,出于某种原因,queryInventory 方法返回了以英镑为单位的价格,只有在用户点击要购买的产品后,google 才会向他显示以欧元为单位的价格。该用户后来告诉我,他的 Nexus 7 是从英国购买的,但他的信用卡是从希腊购买的。所以这也许可以解释它,但仍然让他感到困惑,并且看到我的一位测试用户已经发生这种情况,我可以想象这种情况会更频繁地发生。

此外,我不确定如果应用程序在此过程中更改货币从法律上讲是否可以,用户可能不知道谷歌在这里有错。

所以我想问的是,有没有一种简单的方法可以在我查询库存时强制谷歌显示最终价格?或者是否有一种简单的方法来找出用户将支付的货币(可能从他的 SIM 卡中获取国家)并使用国家变量查询谷歌库存?

提前谢谢你。

这是我的代码:

    // googles IabHelper class
private IabHelper mHelper;
// this carries my products, gets filled in my activity by a request to my server
private List<String> additionalSkuList = new ArrayList<String>();

mHelper.queryInventoryAsync(true, additionalSkuList,
mGotInventoryListener);

// Listener that's called when we finish querying the items and subscriptions we own
IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
L.debug("Query inventory finished.");

// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;

// Is it a failure?
if (result.isFailure()) {
L.debug("Failed to query inventory: " + result);
return;
}

Set<String> skuKeys = inventory.getSkuKeys();

List<String> exceptList=new ArrayList<String>();
mHelper.flagEndAsync();

for (final String sku: skuKeys) {

// this price is not always the one which will be shown when someone
// would start the IAB process
String price = inventory.getSkuDetails(sku).getPrice();

}
};

最佳答案

如果我在希腊并且我使用的是与我的银行账户相关联的美国银行卡,其中有美元,Google 将首先以欧元显示价格。

当他们通过检查我的卡发现我用美元支付时,它会变成美元。

除非您在您的应用中添加货币选择并自行查询汇率,或者您查看用户的私有(private)支付信息(不要这样做),否则无法在用户付款前知道他们将使用哪种货币付款即使你可以)。

编辑:但是,您可以根据所选的系统语言或其他一些识别因素来决定货币。

关于android - 应用内结算库存价格并不总是与用户打算购买时显示的货币相同,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26730548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com