Installing Cordova Plugin on Meteor

I am trying to install this cordova package in my meteor package:

so i run this command from the CLI

meteor add cordova:cc.fovea.cordova.purchase@https://github.com/j3k0/cordova-plugin-purchase.git#79449b8c20c137cfe2fc785d250aa4b92c1c425e

The installation works, but everytime i try to refrence this package from the code i get a Uncaught ReferenceError: store is not defined

Here is the code i am using:

[Client side Code]

Meteor.startup(function () {
   store.register({
   id:    "10stars",
   alias: "10 Stars",
   type:  store.CONSUMABLE
  });
});

Am i running the installation correctly, or am i missing a step?

Are you testing that on a mobile device? Cordova plugins are loaded only on mobile. To make the code work in both places, you have to add a conditional:

Meteor.startup(function () {
  if (Meteor.isCordova) {
    store.register({...});
  }
});
2 Likes

This was the problem all along, how could i be so stupid thank you so much :slight_smile: