Skip to content

hirenf14/chargebee-js

Repository files navigation

Chargebee.js ES Module

License npm version NPM Downloads GitHub Repo stars Code Climate maintainability

Example | CHANGELOG

chargebee-js is npm package to include Chargebee's browser script, instead of adding it as script tag in HTML pages for JS frameworks. Use Chargebee.js as an ES module.

Note: To be PCI compliant, you must load Chargebee.js directly from https://js.chargebee.com. You cannot include it in a bundle or host it yourself. This package wraps the global Chargebee function provided by the Chargebee.js script as an ES module.

Calling loadChargebee always loads the latest version of Chargebee.js, regardless of which version of chargebee-js you use. Updates for this package only impact tooling around the loadChargebee helper itself and the TypeScript type definitions provided for Chargebee.js. Updates do not affect runtime availability of features of Chargebee.js.

Installation

You can install the library using npm or yarn:

npm install chargebee-js
# or
yarn add chargebee-js

How to use

Inside your JavaScript code, initialize chargebee and get Chargebee instance object. This object can further be used for enabling payment integrations, analytics like Google Analytics and Facebook pixel tracking, checkout and portal integrations and more.

import { loadChargebee } from "chargebee-js";

const cbInstance = loadChargebee({
    site: "site-name", // your test site
    domain: "https://mybilling.acme.com" // this is an optional parameter.
})

Documentation

Made with ❤️ by Hiren F | GitHub