Ankita
Ankita

Reputation: 623

Chrome packaged app in-app payment api

I have created a chrome app and trying to get the list of product but I am getting internal server error. The following is a code.

function getProductList() {
  console.log("google.payments.inapp.getSkuDetails");
  statusDiv.text("Retreiving list of available products...");
  google.payments.inapp.getSkuDetails({
    'parameters': {env: "prod"},
    'success': onSkuDetails,
    'failure': onSkuDetailsFailed
  });
}

function onSkuDetails(response) {
  console.log("onSkuDetails", response);
  var products = response.response.details.inAppProducts;
  var count = products.length;
  for (var i = 0; i < count; i++) {
    var product = products[i];
    addProductToUI(product);
  }
  statusDiv.text("");
  getLicenses();
}

function onSkuDetailsFailed(response) {
  console.log("onSkuDetailsFailed", response);
  statusDiv.text("Error retreiving product list. (" + response.response.errorType + ")");
}

Upvotes: 0

Views: 271

Answers (1)

user2539341
user2539341

Reputation: 71

I received this same error because I mistakenly changed the app id inside buy.js to my own app id. I thought that this was the way that the in-app purchase mechanism connected to my app in the chrome web store to access the in-app purchases, but this is not the case at all. What I guess the app-id inside buy.js is the connection to the in-app purchase mechanism built inside Chrome.

So I suggest you try again with the original unmodified buy.js that comes with the test app sample zip package and see if that changes.

The consequence of all of this, is that as far as I can determine it is not possible to debug the in-app purchase flow mechanism, because you can only make it work with a already published app on which in-app purchases have been specified and as such you cannot access the Chrome console. I have not tried unpublishing the app, perhaps that might work. What you cannot do, is clone the app and load it again as an unpackaged extension (as that will of course have a different app-id). Hope this helps.

Upvotes: 1

Related Questions