Skip to main content

Overview

SDK Updates
New versions of the SDK are released frequently, not only to add new features and address issues in the SDK, but also to continuously improve the conversion of merchant login flows. As a result, it is strongly recommended that you frequently update your SDK version across any platforms where you invoke the SDK.
The Knot Link SDK provides a seamless way for end users to link their merchant accounts to your React Native app, serving as the foundation for Knot’s merchant connectivity platform. It is a client-side integration, consisting of initializing & configuring the SDK and handling events.

Installation

The Knot SDK can be installed using npm or yarn in your react-native project directory, like below
From React Native 0.60 and higher, linking is automatic. If you need to manually install the SDK, run the below:
Shell

Usage

Import methods like the below:

Initialization

Your backend will create a session by calling Create Session and provide it to your frontend. To start a Knot session, you must first configure the session with a KnotConfiguration class. The configuration allows you to set the environment, entry point, and other user experience configurations.
It’s expected that your integration with Knot will retrieve and pass a new session into the SDK on each initialization.

Configure the session

The SDK is configured using the following parameters inside the open method:

CustomerConfiguration

This class is entirely optional and infrequently used, typically only when you offer Knot for multiple, differently-named card programs in the same app. The Knot team will set pre-defined values of your choosing for each parameter that you can then subsequently pass into the SDK. Passing a value that is not pre-defined will result in an onError callback. To take advantage of this functionality, please contact the Knot team who will be happy to assist you.
See the following examples for how the parameters are used together in text inside the Knot SDK: "Your [customerName] [cardName | card] was added."

Open the session

To begin the flow, use the open method like below:
To test logging in to a merchant in the SDK, please reference a set of available test credentials for the CardSwitcher product here and the TransactionLink product here.

Single Merchant Flow

If you decide to use List Merchants to retrieve a list of merchants, list them in your app, and then open the SDK with a single merchant, you can do so by passing a merchant ID when configuring the session in the KnotConfiguration. More in Retrieving & Listing Merchants. The merchant ID is the same across all environments.
Although available, it is not recommended that you provide a long list of merchants in order to remove a few, but rather “hide” certain merchants that you desire from your Knot Dashboard.

Entry Points

In your app’s user experience, you may choose to integrate Knot in one or multiple places (e.g. from different tabs or screens). How users behave when interacting with Knot from each of these “entry points” may vary and it will be useful for you to be able to differentiate these groups of users by entry point in order to assess the value of each entry point. You can provide a value for the entry point when configuring the session in Knot.open. This value will be returned in the AUTHENTICATED webhook. Users are presented with a list of merchants in the SDK (unless you provide a single merchant as described above). Accompanying the list is a set of categories and a search experience. Each of these components is visible to users by default (as set in Knot’s backend). You can choose to remove either of them by setting useCategories: false and useSearch: false in Knot.open. This is not recommended.

Events

To receive updates from the SDK, implement the addKnotListener method.
The provided Typescript types can be found below:

onSuccess

This event is called when a user successfully logged in to the merchant and their card was switched. It takes a single string argument containing the name of the merchant.

onError

This event is called when an error occurs during SDK initialization and emits a KnotError with the following errors:
Sessions are valid for 30 minutes. If a session expires while the SDK is open, an expired session error will be emitted via onError and the SDK will automatically close. To provide a seamless experience, handle the REFRESH_SESSION_REQUEST event via the onEvent callback to proactively extend the session using Extend Session before expiration occurs.

onExit

This event is called when a user closes the SDK.

onEvent

This event is called when certain events occur in the SDK. With this callback, you will be able to understand how a user is progressing through their lifecycle of authenticating to a merchant. The following list contains all possible events emitted in the KnotEvent.event property:

Other Options

Get current SDK version

If you need to retrieve the current SDK version for your own use case, implement the following:
JavaScript

Close the SDK

If you need to explicitly close the SDK, use the below method, otherwise end users will naturally close the SDK as they interact with the interface.
JavaScript

Maintain cookies

Android only.
Knot clears cookies for security purposes. If your app relies on cookies, you can allowlist specific domains using the domainUrls configuration in Knot.openThis is uncommon.
JavaScript