谷歌播放付款流程验证错误

时间:2016-07-04 10:46:56

标签: java android google-play-services google-play-developer-api

您好我正在尝试测试我的inapp购买。我已经设置了一个商家帐户,并创建了一组alpha测试人员。但是,当我尝试在设备上的应用程序上启动付款时,我收到以下错误。我已经在2个不同的设备上测试了这个,我得到了同样的错误,虽然我可以下载其他应用程序。

  

错误   需要身份验证。您需要登录自己的Google帐户。

请帮忙

    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
        public void onIabSetupFinished(IabResult result) {
            Log.d(TAG, "Setup finished.");

            if (!result.isSuccess()) {
                // Oh noes, there was a problem.
                complain("Problem setting up in-app billing: " + result);
                return;
            }

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

            // IAB is fully set up. Now, let's get an inventory of stuff we own.
            Log.d(TAG, "Setup successful. Querying inventory.");
            try {
                mHelper.queryInventoryAsync(mGotInventoryListener);
            } catch (IabHelper.IabAsyncInProgressException e) {
                complain("Error querying inventory. Another async operation in progress.");
            }
        }
    });

   //Querying for Items Available for Purchase
   IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() {
    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
        Purchase gasPurchase = inventory.getPurchase(SKU_GAS);
        if (gasPurchase != null && verifyDeveloperPayload(gasPurchase)) {
            Log.d(TAG, "We have gas. Consuming it.");
            try {
                mHelper.consumeAsync(inventory.getPurchase(SKU_GAS), mConsumeFinishedListener);
            } catch (IabHelper.IabAsyncInProgressException e) {
                complain("Error consuming gas. Another async operation in progress.");
            }
            return;
        }

        //updateUi();
        //setWaitScreen(false);
        Log.d(TAG, "Initial inventory query finished; enabling main UI.");
    }
   };

   // User clicked the "Buy Gas" button
   public void onBuyCoinButtonClicked(View arg0) {
    Log.d(TAG, "Buy coin button clicked.");

    Log.d(TAG, "Launching purchase flow for coins.");

    String payload = "";

    try {
        mHelper.launchPurchaseFlow(this, SKU_GAS, RC_REQUEST,
                mPurchaseFinishedListener, payload);
    } catch (IabHelper.IabAsyncInProgressException e) {
        complain("Error launching purchase flow. Another async operation in progress.");
        //setWaitScreen(false);
    }
}

我的来源是来自简单的驱动器示例https://developer.android.com/training/in-app-billing/preparing-iab-app.html

1 个答案:

答案 0 :(得分:2)

第1步:检查基本64键

第2步:检查您的Sku

static final String SKU_GAS = "android.test.purchased";