I'm using the Fovea.cc purchase plugin for an Android Cordova app. The plugin initializes, but cannot find my in-app purchase products - I get the same "Product could not be found" error I would if the product didn't exist or if the app was not published. I'm looking for more troubleshooting steps.
Here's the relevant code, which is called on app launch:
store.register({
id: "com.ineptech.wn.unlockgame",
alias: "unlockgame",
type: store.NON_CONSUMABLE
});
store.ready(function() {
console.log("\\o/ STORE READY \\o/"); // This does get called
});
store.when("unlockgame").approved(function (order) {
UnlockContent();
order.finish();
});
store.refresh();
var p = store.get("unlockgame");
popup("Title = " + p.title);
// this displays "Title = null"
And here's the code for the purchase button:
store.order("unlockgame");
// Results in "The item you were attempting to purchase
// could not be found" error from Play Store
Here's what a purchase attempt displays in logcat:
I/ActivityManager(424): Displayed com.android.vending/com.google.android.finsky.billing.lightpurchase.IabV3Activity: +80ms
E/Volley(22062): [1009] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/preparePurchase
And here's what I've already double-checked:
What else might be keeping the plugin from getting the products?
The issue is most probably with your configuration, but first I see is that you're trying to access the product title right after doing store.refresh()
store.refresh();
var p = store.get("unlockgame");
However, store.refresh()
method is asynchronous and will just trigger a request to the server. You can monitor changes to your product this way:
store.when("unlockgame").updated(function(p) {
alert("product is " + p.state + ", title is " + p.title);
});
Then call:
store.refresh();
Also check that the product ID on the play console is com.ineptech.wn.unlockgame
, not just unlockgame
, and that it's of type Managed
.