Adding 3rd Party Scripts to Meteor App

I’m trying to add a payment service to my Meteor app. It requires the following…

Header Script

<script src="" data-cb-site="my-website" ></script>


<a href="javascript:void(0)" data-cb-type="checkout" data-cb-plan-id="monthly-plan" >subscribe</a>

Something very easy to do with plain old HTML; not so much with Meteor.

I tried adding the script in the <head> of index.html:

  <script src="" data-cb-site="edabit-test"></script>

  <div id="App"></div>

Any standard way of doing this with Meteor?

I think you should go the NPM way with official chargebee npm package the documentation does not look that bad


As far as I can tell, the chargebee NPM package doesn’t handle payments. I just want to trigger their hosted popup form.

Question, are you using Blaze or React?

I’m using React as my view layer.

Bump. Anyone here know how to accept payments with Chargebee in a Meteor app? Should I just hire someone on UpWork to do this?

Did you ever figure this one out? I am also working on embedding the chargebee hosted pages into a meteor app. thanks! :slight_smile:

The easiest way to load a library at any time is via a function which inserts and HTML selector in the head. I use this a lot for loading/unloading libraries for maps or video players. Here’s an example for CSS, similarly you would do for Javascript libraries and scripts.
Simply put, if you don’t find a library already loaded via an HTML selector, load it.

const addCSS = (css, id) => {
  if (!document.querySelectorAll(`link[id='${id}']`).length) {
    const link = document.createElement('LINK')
    link.rel = 'stylesheet'
    link.href = css = id
    link.type = 'text/css'

Here’s an example from the official FB API for Javascript:

if (!document.getElementById('facebook-jssdk')) {
        (function (d, s, id) {
          var js; var fjs = d.getElementsByTagName(s)[0]
          // if (d.getElementById(id)) { return }
          js = d.createElement(s); = id
          js.src = ''
          fjs.parentNode.insertBefore(js, fjs)
        }(document, 'script', 'facebook-jssdk'))