Skip to content

repeatedly receiving this during testing: Invalid response, please check 'Verifier' configuration or the statusCode above #26

@jaredgibb

Description

@jaredgibb

Description

during testing, when acknowledging a subscription recently purchased then cancelled, i receive this
{"errorMessage":"Invalid response, please check 'Verifier' configuration or the statusCode above","errorCode":400,"isSuccessful":false}

Steps to Reproduce

  1. Make a purchase of a subscription
  2. acknowledge the subscription
  3. cancel the item in app
  4. repurchase the subscription

Sample code

exports.googlePlayBillingValidator = functions.https.onRequest((request, response) => {
 
  // capture the data from the request
  const {purchaseObject, subscriptionID, type} = request.body;
  console.log(subscriptionID, type);
  // inclue your app bundle id
  const bundleID = "edu.fit.my.jgibb2018.pob";
  // require the service account info
  const googleServiceAccountKey = require("./pc-api-6835501382478242417-177-5781829bedc5.json"); // see docs on how to generate a service account
  // require the verify module
  const Verifier = require("google-play-billing-validator");
  // create verifier opitons object
  const options = {
    "email": googleServiceAccountKey.client_email,
    "key": googleServiceAccountKey.private_key,
  };
  // create a new verifier instance
  const verifier = new Verifier(options);
  // create a receipt object
  const receipt = {
    packageName: bundleID,
    productId: purchaseObject.productId,
    purchaseToken: purchaseObject.purchaseToken,

  };
  if (type.includes("subscriptionAcknowledge")) {
    // add the following string to the receipt object `developerPayload: "some unique identifier",`
    receipt.developerPayload = "some unique identifier";
  }
  // acknowledge the receipt
  const promiseData = verifier.verifySub(receipt);

  promiseData.then(function(r) {
    response.send(r);
  })
      .catch(function(error) {
        functions.logger.error(error);
        response.send(error);
      });
});

Expected behavior:

i should be able to acknowledge the purchase.

Actual behavior:

i am receiving errors

Versions

2.1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions