Skip to main content

Installing the Abowire JS SDK 🔧

Our SDK provides Typescript support and works both browser and NodeJS environments.

We distribute our SDK as an ECMAScript module (ESM). For your convenience, in the browser you can also import it as an IIFE (Immediately Invoked Function Expression) and load it directly from our CDN.

The first thing you will need to do is add the SDK to your dependencies:

npm install abowire

Then, you can import the SDK into your project:

ECMAScript module (ESM)​

import Abowire from "abowire";

In the browser you can also import the module directly from our CDN:

<script type="module">
import { Abowire } from "https://cdn.abowire.com/sdk/latest/browser.js";

...
</script>
<script
type="module"
src="https://cdn.abowire.com/sdk/latest/browser.js"
></script>

CommonJS (CJS)​

const { Abowire } = require("abowire/dist/node.cjs");

Alternatevely, in the also you can also import the SDK as an IIFE (Immediately Invoked Function Expression) from our CDN:

Browser (IIFE)​

<script
src="https://cdn.abowire.com/sdk/latest/abowire.js?clientId=<your-client-id>&accountId=<your-account-id>&callback=initAbowire"
async
></script>

You can then load the SDK once the script is loaded:

<script>
async function initAbowire() {
const customerSession = await abowire.customer.createSession();
}
</script>

In this case, the SDK will be available in the global abowire variable. Since the SDK is loaded asynchronously, you will need to wait for the initAbowire callback to be called before using it.