Hi I am trying to test my inapp purchases. I have set up a merchant account, and created an alpha group of testers. However when I try initiate a payment on the app on my device I receive the following error. I have tested this on 2 different devices and I get the same error, although I am able to downnload other apps.
Error Authentication is required. You need to sign in to your Google Account.
Please help
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);
}
}
My source is from the trivial drive sample https://developer.android.com/training/in-app-billing/preparing-iab-app.html
Step 1 :Check your base 64 key
Step 2: check your Sku
static final String SKU_GAS = "android.test.purchased";