Using mrgalaxy:stripe vs. npm stripe

Really sorry if this is a super dumb question but I can’t decide which to use.

I’m on the latest version of Meteor (1.8). Is there a difference between these? Is one more up-to-date than the other? There also seems to be some sort of client side checkout that needs to be installed as well… The examples I’m finding all seem to be completely different.

Wow… adding stripe to my app is WAY more complex than I anticipated.

Thank you.

Not familiar with either of these, but in general whenever you have an option to use a widely adopted npm package instead of a Meteor specific galaxy package, you should favor npm. Especially for packages like this. The galaxy one here is probably just a wrapper for some npm ones and very much outdated as well.

1 Like

I haven’t felt this lost since I first started learning to code four years ago. What an absolute mess…

Packages like mrgalaxy:stripe where used a lot before it was easy to use npm packages directly with meteor and as stated by @vooteles is better to pick the npm version as the atmosphere package might be just a wrapper and most probbably will be very outdated, like this one that is almost 2 or 3 years old.

1 Like

I’ll take the advice given here and opt for the npm package (I’ve already been trying to avoid atmosphere packages when possible). However, I’m left wondering how to get Stripe.js working with Meteor. Based on the research I’ve done these past three days, it seems that with Stripe you can go with either Stripe Checkout or Stripe.js (in addition to the API library I referenced above).

  1. Stripe Checkout: Easiest and quickest to setup initially as the UI is done for you. Load up something like react-stripe-checkout and you’re good to go.

  2. Stripe.js: The most flexible in terms of customization. Gives you the most control and options when setting up your payment flow. Harder than the above to integrate.

For my purposes, I’ll be opting for the latter, as I’d prefer to have complete control over my UI. That being said, I’m still a bit unclear as to how I should go about adding Stripe.js to my project. I mean, it can’t be a matter of just dropping their script tag into my intex.html…?

So far, the resources I’ve found all reference Stripe Checkout. I’m having difficulty locating recent (i.e. not outdated) information on using Stripe.js with Meteor.

Suggestions very welcome! :grin: :smiling_face_with_three_hearts:

So I’m thinking, if I add this to my checkout container component, it might just work…

componentDidMount() {
  function loadScript() {
    let script = document.createElement('script')
    script.type = 'text/javascript'
    script.src = 'https://js.stripe.com/v2/'
    script.async = true
    document.body.appendChild(script)
  }
  loadScript()
}

I would strongly suggest exploring Stripe Elements.

In addition to getting a decent UI out of the box, there are a few other perks that I think easily make it worth it:

  • Auto detection of mobile support for taking a screen cap of a card
  • Not having to worry about things hijacking your inputs
  • Great auto-formatting of inputs

Also, I think if you take a look at Stripe’s documentation, you will find that you want to keep the script in the header if at all possible, as having the script loaded on all of your site’s pages will help Stripe detect fraudulent behaviors more easily.

I’m using npm stripe and happy with it. Haven’t tried mrgalaxy:stripe so can’t compare them.

I would strongly advise against appending a script tag from your JS.

The script tag should work if you add it directly to your index.html file

It looks like npm stripe is the server side code only. Using Stripe.js via script tag likely means you don’t need to use npm stripe at all (or the atmosphere package)