Overview
The Knot Link SDK provides a seamless way for end users to link their merchant accounts to your 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 pub package manager.Shell
Import the SDK
Dart
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 aKnotConfiguration class. The configuration allows you to set the environment, product type, 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
TheKnotConfiguration and CustomerConfiguration classes are used to initialize the SDK with specific parameters.
KnotConfiguration
CustomerConfiguration
See the following examples for how the parameters are used together in text inside the Knot SDK:
"Your [customerName] [cardName | card] was added."
Dart
Open the session
To begin the flow, use theopen method with a KnotConfiguration instance.
Dart
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 theKnotConfiguration. 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 Customer 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 inKnotConfiguration.entryPoint when configuring the session. This value will be returned in the AUTHENTICATED webhook.
Categories & Search
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 settinguseCategories: false and useSearch: false in KnotConfiguration. This is not recommended.
Events
To receive updates from the SDK, import the following:Dart
onSuccess
This event is called when a user successfully logged in to the merchant and their card was switched. It takes a single argument KnotSuccess.
Dart
onError
This event is called when an error occurs during SDK initialization and it takes a single argument KnotError.
Dart
onExit
This event is called when a user closes the SDK. It takes a single argument KnotExit.
Dart
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. It takes a single argument KnotEvent.
Dart
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:Dart
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.Dart
Maintain cookies
Knot clears cookies for security purposes. If your app relies on cookies, you can allowlist specific domains using thedomainUrls configuration in KnotConfiguration. This is uncommon.
Dart