Overview

The Benji SDK is a simple javascript SDK meant to simplify connectivity to your reward loyalty partner. Once initialized, the SDK will take of authenticating your user with their reward partner and returning back a user specific access token which you can then use to interact with the Benji API to trigger any relevant reward campaign. The SDK operates in 2 distinct modes :

  • Direct : In this mode the Benji Connect SDK will connect your members with your exclusive reward partner.
  • Marketplace : In this mode the Benji Connect SDK will allow your users to select from a list of reward partners that are part of the Benji Partner Network.

The mode in which the connect SDK will be opened is defined by your private Authentication token given to you as part of your onboarding process. You can also see your authentication token in your settings page on Pilot

Benji Connect Flow

The flow to to connect a member to their loyalty reward program using the Benji Connect SDK is as follows :

  • Call the token/create Auth API endpoint to generate an initialization token to pass to the SDK. When calling this endpoint, you will be providing basic information such as user identifier, geo location if applicable, product information etc..
  • Initialize the SDK using the token retrieved from the previous endpoint. When initializaing the SDK, you will also be passing success, error and event callback functions in order to listen to events coming from the SDK.
  • Interact with the SDK and listen to events coming from the SDK, giving you information regarding the user’s journey and status while going through the Benji Connect flow.
  • Exchange the token returned on the onSuccess event using the token/exchange Auth API endpoint to retrieve a user specific access token and refresh token. This will be the token you will be using when interacting with the Benji Platform APIs.

The user specific token returned to you from the token/exchange endpoint is a private token. If you are storing this token, make sure to store it securely