Installation

From NPM

Tebex.js is available as an NPM package, which you can install using your preferred JS package manager:

npm install @tebexio/tebex.js

The Tebex object can then be imported into your code like so:

import Tebex from "@tebexio/tebex.js";

From Our CDN

Alternatively, we also provide Tebex.js via our own CDN, which you can add as a script within the <head> tag of your website:

<script defer src="https://js.tebex.io/v/1.js"></script>
circle-info

We will automatically update v/1.js with new minor and patch releases of Tebex.js. This shouldn't present any breaking changes, but if you would prefer to stay on a fixed version, you can specify the full version number in the URL, for example https://js.tebex.io/v/1.1.1.js. Our version history can be found on our GitHubarrow-up-right releases page.

When installing Tebex.js this way, the Tebex object will become available globally on the window object.

We recommend using defer on the script to prevent it from blocking your website's initial page render, but when doing do, it's important to wait for the page load event before you begin configuring the checkout or payment portal:

<script>
    addEventListener("load", function() {
        // Configure Tebex.js here
    });
</script>

Next Steps

The Tebex object provides the following APIs:

  • Tebex.checkout - for allowing customers to make purchases without leaving your website.

  • Tebex.portal - for allowing existing customers to review their purchase history and subscriptions without leaving your website.

Last updated