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
- Make a purchase of a subscription
- acknowledge the subscription
- cancel the item in app
- 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
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
Sample code
Expected behavior:
i should be able to acknowledge the purchase.
Actual behavior:
i am receiving errors
Versions
2.1.3