Integrate Tebex Checkout directly into your own website or game using our embedded checkout experience.
You can view a live demo of this repo by visiting https://js.tebex.io
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'
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.0.0.js"></script>
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:
<script>
addEventListener('load', function() {
// Configure Tebex.js here
})
</script>
Before your checkout can be launched, it must first be configured by calling the Tebex.checkout.init()
method:
Tebex.checkout.init({
ident: "your checkout request ident goes here"
})
The only required option is ident
, which you must replace with the checkout request ident retrieved from using the Headless API or the Checkout API (depending on your integration method).
For further information regarding configuration options - such as checkout branding colors - please refer to the Tebex.js Documentation.
When you are ready to show the Tebex.js checkout to your user, you can call the Tebex.checkout.launch()
method. On desktop devices this will open the checkout as a popup, while on mobile devices it will open as a new tab.
We recommend reading the full Tebex.js Documentation to get an overview of all available options, events, and advanced functionality.
For issues relating to this library, please contact support@tebex.io.