您已拥有此商品的错误 [英] Error You Already Own This Item

查看:64
本文介绍了您已拥有此商品的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个新的android应用,其中添加了应用内帐单,但很沮丧.

I have a new android app in which I am adding in-app billing and I am tearing my hair out with frustration.

我已经上传了签名的APK,并已发布到Alpha.我创建了一组应用内商品并将其全部激活.我创建了一个新的Gmail帐户,并将其定义为应用apk页面上该应用的测试人员.我已将我的Android手机恢复出厂设置,并使用新的Gmail帐户对其进行了初始化.我已经在chrome中输入了/apps/testing链接,并注册为测试人员.然后,我下载并安装了我的应用程序.在我的应用程序内部,我询问了可用的应用程序内产品,并向他们显示了我在上面创建的产品集.我选择了一个进行购买,并经历了以下购买过程.1.屏幕显示要购买的产品和价格,并要求按继续,我该怎么做2.屏幕显示付款方式,我选择兑换代码3.屏幕显示赎回您的代码,我输入了我之前在开发者控制台中设置的促销代码之一(上面没有提到-抱歉),然后按赎回4.屏幕再次显示产品,这次价格划掉了,并提供了添加我选择的项目的选项(很奇怪,要求再次添加购买嘿嘿)5.屏幕显示添加的项目6.几秒钟后,屏幕显示错误,您已经拥有此项目.

I have uploaded a signed APK and published to alpha. I created a set of in-app products and activated them all. I have created a new gmail account and defined them as a tester for the app on the app apk page. I have factory reset my android phone and initialised it with the new gmail account. I have entered the /apps/testing link in to chrome and signed up as a tester. I then downloaded and installed my app. Inside my app I asked for the in app products that were available and was shown the set i created above. I selected one to buy and went through the following purchase process. 1. Screen shows product to be purchased and price and requests press continue which i do 2. Screen shows payment methods and I select redeem code 3. Screen shows redeem your code and I enter one of the promotion codes I set up in the developer console earlier (not mentioned above - sorry) and press redeem 4. Screen shows product again, this time with price crossed out and offers option to add item which I select (very strange being asked to add again buy hey ho) 5. Screen shows item added 6. After a fews seconds screen shows Error you already own this item.

怎么可能,该用户在十分钟前不存在,并且如上所述仅使用了此应用一次.

How can this be, this user did not exist before ten minutes ago and has only used this app once as described above.

我在堆栈溢出和其他类似地方看到了很多问题,并尝试了一切,清除了Google Play商店缓存,清除了Google Play商店数据,等等.以上描述的顺序是我对完全干净的用户进行的最新尝试.电话.

I have seen many questions in stack overflow and elsewhere similar to this and tried everything, clearing google play store cache, clearing google play store data etc. This sequence described above is my latest attempt with a completely clean user on a completely clean phone.

我可以上传我使用过的应用代码,但是错过了要点,这就是当该gmail帐户从未从任何人那里购买过任何东西时,该gmail帐户如何拥有一个商品.当然,这是一个错误.

I could upload my app code used but that misses the point, which is how can this gmail account already own an item when this gmail account have never purchased anything before from anyone. Surely this is a bug.

关于如何进行的所有线索都非常受欢迎.现在添加了代码,请注意,这是一个混合的android应用,其中用户购买决策代码位于javascript/html中,而应用内操作则位于下面的包装器代码中

All clues very welcome as to how to proceed. Code now added, note this is a hybrid android app, with the user purchase decisions code in javascript/html and the in app actions in the wrapper code below

private void processCommand(JSONObject commandJSON) throws JSONException
    {
    String command = commandJSON.getString("method");
    if ("GetInAppProducts".equals(command))
        {
        Log.d(TAG, "Querying Inventory");
        InAppPurchaseSkuString = null ; // clear the purchased sku. Note this is tested in mConsumeFinishedListener
        mHelper.queryInventoryAsync(true, itemSkus, new IabHelper.QueryInventoryFinishedListener()
            {
            @Override
            public void onQueryInventoryFinished(IabResult iabResult, Inventory inventory)
                {
                InventoryRecord = inventory ;
                if (iabResult.isFailure())
                    {
                    Log.d(TAG, "Query inventory failed");
                    SendEndItemsToApp ();
                    }
                else
                    {
                    Log.d(TAG, "Query inventory was successful.");
                    InventoryCheckCount = 0 ; // seems that we cannot just fire off a whole lot of these checks at the same time, so do them in sequence
                    if (itemSkus.size()>0) { CheckForOwnedItems (); } else { SendEndItemsToApp (); }
                    }
                }
            });

        }
    else if ("BuyInAppProduct".equals(command))
        {
        JSONArray params = commandJSON.getJSONArray("parameters");
        InAppPurchaseSkuString = params.getString(0);
        Log.d(TAG, "User decision to purchase " + InAppPurchaseSkuString);
        mHelper.launchPurchaseFlow( MainActivity.this, InAppPurchaseSkuString, InAppPurchaseActivityCode, mPurchaseFinishedListener, "mypurchasetoken"); // consider putting the user email address in the last field - need to get from app
        };
    }//end of ProcessCommand


public void CheckForOwnedItems ()
    {
    Log.d(TAG, "Pre Purchase Inventory Processing Started");
    String sku = itemSkus.get(InventoryCheckCount);
    if (InventoryRecord.getSkuDetails(sku) != null)
        {
        if (InventoryRecord.hasPurchase(sku))
            {
            consumeItem ();
            }
        else
            {
            SendItemToApp ();
            InventoryCheckCount++;
            if (InventoryCheckCount < itemSkus.size()) { CheckForOwnedItems (); } else { SendEndItemsToApp (); }
            };
        };
    }//end of CheckForOwnedItems

public void SendItemToApp ()
    {
    String sku = itemSkus.get(InventoryCheckCount);
    String priceString = InventoryRecord.getSkuDetails(sku).getPrice().replaceAll("[^\\d.]+", ""); // RegExp removes all characters except digits and periods
    String infoString = "InAppProductDetails('" + sku + "','" + "dummy" + "','" + priceString + "');"; // dummy is a placeholder for product description which is not (yet?) used in the app
    Log.d(TAG, infoString);
    mWebView.evaluateJavascript (infoString, new ValueCallback<String>()
            {
            @Override
            public void onReceiveValue(String s)
                {
                //Log.d(TAG,"Returned from InAppProductDetails:");
                }
            }
        );
    }

public void SendEndItemsToApp ()
    {
    String endString = "InAppProductsEnd();"; // name is a placeholder for now
    Log.d(TAG, endString);
    mWebView.evaluateJavascript(endString, new ValueCallback<String>()
            {
            @Override
            public void onReceiveValue(String s)
                {
                //Log.d(TAG,"Returned from InAppProductsEnd:");
                }
            }
        );
    }

public void consumeItem()
    {
    Log.d(TAG,"Pre Purchase Inventory Query Started");
    String sku = itemSkus.get(InventoryCheckCount);
    mHelper.consumeAsync(InventoryRecord.getPurchase(sku), mConsumeFinishedListener);
    }

IabHelper.OnConsumeFinishedListener mConsumeFinishedListener = new IabHelper.OnConsumeFinishedListener()
    {
    public void onConsumeFinished (Purchase purchase, IabResult result)
        {
        if (result.isSuccess())
            {
            Log.d(TAG, "Pre Purchase Consume Item Completed");
            SendItemToApp ();
            InventoryCheckCount++;
            if (InventoryCheckCount < itemSkus.size()) { CheckForOwnedItems (); } else { SendEndItemsToApp (); }

            }
        else
            {
            Log.d(TAG,"Pre Purchase Consume Item Failed");
            }
        }
    };

IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener()
    {
    public void onIabPurchaseFinished (IabResult result, Purchase purchase)
        {
        if (result.isFailure())
            {
            Log.d(TAG,"Purchase Scenario Failed");
            }
        else if (purchase.getSku().equals(InAppPurchaseSkuString))
            {
            Log.d(TAG,"Purchase Scenario Completed");
            String evalString = "InAppProductPurchased('" + InAppPurchaseSkuString + "');";
            Log.d(TAG, evalString);
            mWebView.evaluateJavascript (evalString, new ValueCallback<String>()
                        {
                        @Override
                        public void onReceiveValue(String s)
                            {
                            Log.d(TAG, "Returned from InAppProductPurchased:");
                            }
                        }
                );
            }
        }
    };

推荐答案

我发现使用Paypal(即真钱)进行购买时不会发生此错误,因此我认为此您已拥有此错误"项目"消息以某种方式与使用促销代码进行测试有关.并且(到目前为止)我的Paypal帐户尚未付款(因为我是该应用的重新注册测试人员).

I have found that this error does not occur when using paypal (i.e. real money) to make the purchase, so I believe that this "Error you already own this item" message is in some way connected to using a promotion code for the test. And (so far) my paypal account has not been charged (as I am a resgistered tester for the app).

这篇关于您已拥有此商品的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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