1

I feel like I’m missing something really silly here!

After much confusion, reading and printing off seemingly endless contradictory information, I finally dived in and started testing in app billing. The activity is connecting ok to the Google Play server because it is returning the sku and price ok when calling getSkuDetails() in OnCreate().

I have set up product Id’s on the developer console, and also a test user. I uploaded an APK onto Alpha Testing a few days ago. On my device, signed in to Google Play Store with my developer account and ran the app in debug mode, setting android.test.cancelled as the product id in the launchPurchaseFlow () (in IabHelper).

The Google Payment dialog pops up, I click BUY and then unexpectedly get a Payment Successful message.

In the LogCat, the billing response code is 0 (BILLING_RESPONSE_RESULT_OK), causing handleActivityResult() to check the returned signature and purchasedata, which aren’t there ( makes sense? - because a purchase has not been requested in the first place). mPurchaseFinishedListener then treats this as an unknown error –1008.

public void onButtonClicked(View view) {
        //  Call BILLING API:
        //
        if (!billingStartedOk) {
            Toast.makeText(context, "Purchase requires Google Play Store (billing) on your Android.", Toast.LENGTH_LONG).show();
            return;
        }
        String payload = GameVariables.genPayLoad(); //   
        try {
            mHelper.launchPurchaseFlow(activity, reservedProductIdCancelled, RC_REQUEST, mPurchaseFinishedListener, payload);
        } catch (IabHelper.IabAsyncInProgressException e) {
            e.printStackTrace();
        }
    }

D/GWL: in handleActivityResult, got responseCode = 0

D/GWL: in handleActivityResult, got resultCode = -1

E/IabHelper: In-app billing error: BUG: either purchaseData or dataSignature is null.

D/GWL: in handleActivityResult, got purchaseData == null || dataSignature == null

D/GWL: In mPurchaseFinishedListener - returned result.getResponse() = -1008

D/GWL: **** TrivialDrive Error: Error purchasing: IAB returned null purchaseData or dataSignature (response: -1008:Unknown error)

D/GWL: In mPurchaseFinishedListener - got !result.isSuccess

GeoffL
  • 121
  • 7
  • Possible duplicate of [Google Play In-App Purchase returns error code -1008: null puchaseData or dataSignature](http://stackoverflow.com/questions/16377755/google-play-in-app-purchase-returns-error-code-1008-null-puchasedata-or-datasi) – Sergei Bubenshchikov May 03 '17 at 03:33

0 Answers0