For the complete documentation index, see llms.txt. This page is also available as Markdown.

Checkout SDK

The Zotlo Web Checkout SDK allows you to display a seamless checkout form inside your web application. Your users can complete their purchase without leaving your site, while Zotlo securely handles payment processing, subscription creation, and 3D Secure (3DS) authentication.

Quick Start

1. Install the SDK

NPM
npm install zotlo-checkout
Yarn
yarn add zotlo-checkout

2. Import the SDK

import 'zotlo-checkout/dist/zotlo-checkout.css';
import ZotloCheckout from 'zotlo-checkout';

3. Initialize Checkout

const checkout = await ZotloCheckout({
  token: 'YOUR_CHECKOUT_TOKEN',
  packageId: 'YOUR_PACKAGE_ID',
  returnUrl: 'YOUR_RETURN_URL',
  language: 'en',
  customParameters: {
    myCustomParam: 'OK!'
  },
  events: {
    onSuccess(result) {
      // Payment succeeded
    },
    onFail(error) {
      // Payment failed
    }
  }
});

4. Mount Checkout Form

Using via CDN

UNPKG

jsDelivr

Usage Example

Configuration Parameters

Parameter
Required
Description

token

Yes

Checkout token from Zotlo Dashboard → Developer Tools → Checkout SDK

apiUrl

No

Base URL of the API the checkout sends its requests to. Defaults to the Zotlo Checkout API. Required in the sandbox environment: set it to https://checkout-sandbox.zotlo.com/v1.

packageId

Yes

ID of the package to be purchased

returnUrl

Yes

URL to redirect after payment or 3DS

subscriberId

No

Prefilled subscriber identifier (email, phone, UUID v4)

enableDiscountCodeEntry

No

Controls whether customers can enter a discount code on the payment form.

  • true → The "I have a discount code" field is displayed and customers can enter a code.

  • false → The "I have a discount code" field is hidden and code entry is disabled.

  • null → The Embedded Form settings in the Zotlo Panel are used.

style

No

Custom styling configuration

customParameters

No

Custom key-values sent to webhooks

events

No

Event listeners during checkout lifecycle

events.onLoad

No

Triggers after form loaded.

events.onSubmit

No

Triggered after the form is submitted.

events.onSuccess

No

Triggered after a successful payment.

events.onFail

No

Triggered when a payment fails.

events.onOfferFail

No

Triggered when a post payment offer request fails.

events.onInvalidForm

No

Triggers when form has an invalid field.

events.onError

No

Triggers when pre-init errors occurs.

Event Listeners

onLoad

onSubmit

onSuccess

onFail

onOfferFail

Triggers when a post payment offer request fails. error.data holds the offer the decision was sent for.

Note: You can see error details on type FailEventData and the offer on type OffersObject

onInvalidForm

SDK Methods

mount(containerId: string)

Embeds the checkout form into a DOM element.

refresh()

Reloads the form (e.g., after a style or language update).

unmount()

Removes checkout form from the DOM.

Branding & Styling

You can override default styles configured in Zotlo Dashboard.

More details are available in IZotloCheckoutStyle.

Last updated