title: How to implement in-app-purchase using Cordova plugin?
body: <p>Please tell me the way to implement in-app-purchase using Cordova plugin.</p>
  
  <p>I'm developing Android application using Cordova.
  There are some in-app-purchase plugins but I decide to use Cordova Purchase Plugin.</p>
  
  <p>I did some setups along README.md of <a href="https://github.com/j3k0/cordova-plugin-purchase">In-App Purchase for PhoneGap / Cordova iOS and Android</a>.
  As a result, I could call the Plugin using <a href="https://github.com/Fovea/cordova-plugin-purchase-demo">Demo of the Purchase Plugin for Cordova</a> with my little modification. (See the following, it is a portion of code.)</p>
  
  <pre><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 (i.e. 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's fine to do this only at application startup, as it could be
  // pretty expensive.
  log('refresh');
  store.refresh();
  };
  </code></pre>
  
  <p>It did not show 'Store not available' that is shown when plugin is not available, show 'registerProducts', and 'refresh.'
  (*Of course I added 'myProductA' to in-app Products on Google Play Developer Console.)</p>
  
  <p>But I noticed that the below function is not called.</p>
  
  <pre><code>store.when("product").updated(function (p)
  </code></pre>
  
  <p>And also I couldn't understand what the parameter should fill in it, so I commented out the below.
  (*I did remove the comment out, but it still not working.)</p>
  
  <pre><code>store.validator = "https://api.fovea.cc:1982/check-purchase";
  </code></pre>
  
  <p>I guess those things make something wrong.
  I'm not sure what is stack on me, so my question is not clearly.
  I want some clues to solve it... or I shouldn't implement in-app-purchase using Cordova plugin?</p>
  
  <p>Please give me your hand.</p>
  
  <p>(I'm not fluent in English, so I'm sorry for any confusion.)</p>