Alone in the dark: In-App Purchases with Meteor

Hey guys,

After a few days trying to figure out by myself how to implement an in-app purchase (auto-renew subscription) on a Meteor app (iOS + Android), I realized it would be wiser to ask for help…

My questions are:

1 - Which Cordova plugin to use?

There are two main options around:

Option #1 looks much simpler to use. However, I couldn’t find any boilerplate code to get inspired and have no idea where to put my code (server? client? both? inside Meteor.startup? inside Meteor.isCordova?)

2 - How to connect purchases to useraccounts?

Simple thing: When a user’s subscription status is OK, login works. When it isn’t, login blocks.

3 - What about front-end?

Do I have to create a “subscription confirmation screen” or just a button that triggers a standard screen on iOS / Android? Is there any front-end code at all that I have to write, or just the server-side connection to the stores?

That’s it! I will be immensely grateful for the generous soul who helps me get this done. Thanks!

#1 cordova plugins only work client side

Hey,

So this means all of the code should be written in client-side, wrapped in “Meteor.isCordova( )” ?

Yes. That’s pretty much the way you do Cordova.

Such aprocess needs definitely to be validated on the server. A client-only implementation will lead to many happy users with free subscriptions :wink:

You could on the server use alanning:roles and add/remove roles / groups to users that have a paid subscription vs. those who don’t and check in all Methods/Publications for userIsInRole and throw if not.

With this you can easily wire all subscription-related services up to the roles system and ensure, that relevant code won’t reach the client.

The rest is UI routing on top of that. A question that remains is how you actually implement the purchase process (using usually a third party vendor like PayPal or crypto currencies etc.)

2 Likes