Best way to do In-App Purchases on Meteor app?

@alveoli nevermind. I figured it out.

For anyone else who runs into this, here is what happened. When I first began testing in app purchases on Android, I put a bogus “billing_key_param” in my mobile-config.js. Eventually I put the right value in there (it wouldn’t build until I did) and did a purchase of a NON-CONSUMABLE with a test user. After the purchase completed, the app crashed. Then it would crash on startup (apparently on store.refresh()).

After searching quite a bit, most clues pointed to the “billing_key_param” so I did a search for that in the meteor build directory and found that bogus value in

.meteor/local/cordova-build/platforms/android/res/values/billing_key_param.xml

So I deleted cordova-build directory, rebuilt and did another search in my meteor build dir - only thing there now was the real value.

Problem solved.

So… I’m looking for a more up-to-date answer to this…

Is there a good solution for accepting in-app-purchases in Meteor right now?
Will there be?

Is this a recommended /advisable method for making enterprise software in Meteor?

@rross, the latest version of this plugin works fine as of Meteor 1.6.0. The key to getting this to work is the following:

  • install the plugin:
meteor add cordova:cc.fovea.cordova.purchase@7.1.0

(as of mid Feb 2017)

  • In your mobile-config.js, add the following line:
App.configurePlugin('cc.fovea.cordova.purchase', {BILLING_KEY : "<YOUR_BILLING_KEY>"}); //<YOUR_BILLING_KEY> is the key supplied by Google.

NOTE the lack of ‘cordova:’ in front of cc.fovea.cordova.purchase.

  • Make sure you have the store wrapped within both a Meteor.startup and a Meteor.isCordova. Since this is cordova specific, there’s no way to show it in the browser. Once it’s wrapped in both of those, everything seems to work just fine if you follow the examples set out in the documentation (https://github.com/j3k0/cordova-plugin-purchase).

Good luck.

3 Likes