Please tell me the way to implement a purchase through the application using the Cordova plugin.
I am developing an Android application using Cordova. There are some plugins for connecting to applications, but I decided to use the Purchase Cordova plugin.
I made some settings on the README.md In-App Purchase for PhoneGap / Cordova iOS and Android . As a result, I could call the plugin by demonstrating the purchase plugin for Cordoba with my little modification. (See the following, this is part of the code.)
app.initStore = function() { if (!window.store) { log('Store not available'); return; } // Enable maximum logging level store.verbosity = store.DEBUG; // Enable remote receipt validation // store.validator = "https://api.fovea.cc:1982/check-purchase"; // Inform the store of your products log('registerProducts'); store.register({ id: 'myProductA', alias: 'myProductA', type: store.CONSUMABLE }); // When any product gets updated, refresh the HTML. store.when("product").updated(function (p) { console.info("app.renderIAP is called"); app.renderIAP(p); }); // Log all errors store.error(function(error) { log('ERROR ' + error.code + ': ' + error.message); }); // When purchase of an extra life is approved, // deliver it... by displaying logs in the console. store.when("myProductA").approved(function (order) { log("You got a ProductA"); order.finish(); }); // When the store is ready (ie all products are loaded and in their "final" // state), we hide the "loading" indicator. // // Note that the "ready" function will be called immediately if the store // is already ready. store.ready(function() { var el = document.getElementById("loading-indicator"); console.info(el + "ready is called") if (el) el.style.display = 'none'; }); // When store is ready, activate the "refresh" button; store.ready(function() { var el = document.getElementById('refresh-button'); console.info(el + "ready is called and refresh-button show?"); if (el) { el.style.display = 'block'; el.onclick = function(ev) { store.refresh(); }; } }); // Refresh the store. // // This will contact the server to check all registered products // validity and ownership status. // // It fine to do this only at application startup, as it could be // pretty expensive. log('refresh'); store.refresh(); };
It did not show "Store not available", which is displayed when the plugin is unavailable, "registerProducts" and "refresh" are displayed. (* Of course, I added "myProductA" to application apps in the Google Play Developer Console.)
But I noticed that the function below is not called.
store.when("product").updated(function (p)
And also I could not understand what this parameter should fill in, so I commented on this below. (* I deleted the comment, but it still does not work.)
store.validator = "https://api.fovea.cc:1982/check-purchase";
I think these things are doing something wrong. I'm not sure what is on my stack, so my question is incomprehensible. I want some hints to resolve it ... or should I not implement the purchase through the application using the Cordova plugin?
Please give me your hand.
(I do not speak English, so I'm sorry for any confusion.)