Overview

To simplify your application logic and integration with the Knot JS SDK, Version 1.0 includes a number of breaking changes that may affect the way your integration works or behaves.

The new version includes a number of significant improvements:

  1. Enhanced speed and stability in loading merchant flows.
  2. More streamlined initialization of the SDK.
  3. Simplified event handling, more informative event messaging, and uniform naming conventions for easier debugging.
  4. Improved maintainability and foundations for new feature compatibility.

Breaking Changes

Configuring and opening the Knot SDK has changed significantly in JS Version 1.0 and requires some refactoring in order to initialize the SDK with a session. Errors are now encapsulated in a KnotError object which provides an enumerated value to debug with.

Session Initialization

Changes

  • Knot.openCardOnFileSwitcher is replaced with a more flexible open.
  • The product type is now defined by Product values "card_switcher" | "transaction_link".

Before

JavaScript
  import KnotapiJS from "knotapi-js";
const knotapi = new KnotapiJS();

// Invoke the openCardOnFileSwitcher method with required parameters
knotapi.openCardOnFileSwitcher({
 	 	sessionId: "Your Session ID",
  	clientId: "Your Client ID",
  	environment: "development"  // or "production"
});

After

import KnotapiJS from "knotapi-js";
const knotapi = new KnotapiJS();

// Invoke the open method with required parameters
knotapi.open({
sessionId: "Your Session ID",
clientId: "Your Client ID",
environment: "development",  // or "production"
product: "card_switcher"   
});

Event Handling

Changes

  • All events introduce a product argument to help distinguish events in your code.

Before

JavaScript
onSuccess: (merchant) => {
  console.log("onSuccess", merchant);
}

onError: (errorCode, errorMessage) => {
  console.log("onError", errorCode, errorMessage);
}

onExit: () => {
    console.log("onExit");
}

onEvent: (event, merchant, taskId) => {
    console.log("onEvent", event, merchant, taskId);
}

After

JavaScript

onSuccess: (product, merchant) => {
  console.log("onSuccess", merchant);
}

onError: (product, errorCode, errorMessage) => {
  console.log("onError", errorCode, errorMessage);
}

onExit: (product) => {
    console.log("onExit");
}

onEvent: (product, event, merchant, taskId) => {
    console.log("onEvent", event, merchant, taskId);
}