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

时间:2014-11-04 08:23:35

标签: android in-app-purchase in-app-billing

我的Android应用程序正在使用In-App-Purchases / In-App-Billing,整个过程到目前为止工作得很好。我唯一的问题是有时候货币会在这个过程中发生变化。我的意思是,当我使用mHelper.queryInventoryAsync()查询库存时,我获得的价格/货币有时与用户点击要购买的商品时显示的价格/货币不同。

例如,有一个来自希腊的用户,因为queryInventory方法以磅为单位返回价格而且只有在用户点击产品购买后,谷歌才向他提供欧元价格。该用户后来告诉我,他从英国获得了他的Nexus 7,但他的信用卡来自希腊。所以这可能会解释它,但它仍然让他感到困惑,并且看到它已经对我的一个测试用户感到高兴,我可以想象这可能会更频繁地发生。

此外,我不确定如果一个应用程序在此过程中更改了货币,合法地说它是否合适,用户可能不知道谷歌在这里有问题。

所以我在这里问的是,当我查询库存时,是否有一种简单的方法可以强制Google提供最终价格?或者有一种简单的方法可以找出用户将支付的货币(可能从他的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();                 

      }
    };  

1 个答案:

答案 0 :(得分:1)

如果我在希腊并使用与我的银行账户相关联的美国卡,其中包含美元,谷歌将首先以欧元计价。

当他们发现我通过查看我的卡支付美元时,它将变为美元。

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

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