Skip to content

Generate a checkout token

⚠️ Warning

This is a work in progress and not yet available.

If you want to use managed version of Geins Checkout you will need to create a checkout token. This token will be used by the checkout to load the cart and customer information. The token can also carry the look and feel of your brand during the checkout process.

Example: Generate a checkout token

typescript
import { GeinsCore } from '@geins/core';
import { GeinsOMS } from '@geins/oms';
import type { GenerateCheckoutTokenOptions } from '@geins/types';

const geinsSettings = {
  apiKey: 'your-api-key', // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
  accountName: 'your-account-name', // 'name'
  channel: 'your-channel-id', // '1'
  tld: 'your-tld', // 'com'
  locale: 'your-locale', // 'en-US'
  market: 'your-market', // 'us'
};

const geinsCore = new GeinsCore(geinsSettings);
const geinsOMS = new GeinsOMS(geinsSettings);

const checkoutTokenOptions: GenerateCheckoutTokenOptions = {
  cartId: 'my-cart-id',
};

// generate checkout token
const token = await geinsOMS.createCheckoutToken(checkoutTokenOptions);
window.open(`https://checkout.geins.services/${token}`);

Generate a checkout token

Follow these steps to generate a token for the checkout:

1. Set up your Geins Settings

2. Create a Cart

3. Generate a checkout token

Checkout Settings

Urls

Url to redirect to after successful checkout, if you don't want to use the default one.

Url to redirect to if user cancels the checkout.

Url to redirect to if an error occurs during the checkout, if you want to use a custom one.

Will display a Terms link on the checkout page.

Will display a Privacy link on the checkout page.

Checkout Branding

Optional title for the checkout page. A tip is to add your brand name here if you don't wanna use a logo.

Used next to the logo or title. Will be shown in a circle as 48x48px

Url for your logo. Will be shown 48px high with auto width.

Font size of the body text

Radius of UI elements in pixels

Branding Colors

The colors below are set to the default values.

The first background color

Color for text and icons used on the first background color

Used as a secondary background color

Color for text and icons used on the secondary background color

Color used on buttons and other accent elements

Color for text and icons used on accent elements

Color for borders

Color used for sale prices in the cart

Released under the MIT License.