React Native

Installation

with npm

npm install --save react-native-fuse-connect

iOS setup

There are no additional setup required for iOS.

Android setup

Add the following activities to your AndroidManifest.xml file between the <application> tag.

<application>
    <!-- ... -->
    <activity
        android:name="com.letsfuse.connect.FuseConnectActivity"
        android:theme="@style/Theme.AppCompat.Light">
    </activity>
    <activity
        android:name="com.letsfuse.connect.SnaptradeConnectActivity"
        android:theme="@style/Theme.AppCompat.Light">
    </activity>
</application>

Opening Fuse Connect

  1. Initialize the useFuse hook
const { open, ready } = useFuse({
    clientSecret: 'CLIENT_SECRET_FROM_SERVER',
    onInstitutionSelected: async (institutionId: string, clientSecret) => {
      // Generate link token
      var linkToken = 'GENERATED_LINK_TOKEN'
      return linkToken
    },

    onSuccess: (publicToken: string) => {
      // Handle callback
    },
    onExit: () => {
      // Handle callback
    },
})
  1. Invoke open to show the Fuse Connect view.
open();

Hook arguments

FieldTypeRequiredDescription
clientSecretStringYesA string representing the generated client secret. This secret is used to authenticate the API and grant access to bank data. See /session
onInstitutionSelectedFunctionYesA function that is called when a user selects an institution to link. The function expects one parameter:

institution_id - Represents the unique identifier for the selected bank.

Return the link token generated by the backend. See /link/token for how to generate a link token.
onSuccessFunctionYesA callback function that is called when the user successfully connects their bank account. The function takes one parameter:

public token - A temporary token that can be exchanged for an access token to access the user's bank data. See /financial_connections/public_token/exchange
onExitFunctionYesA callback function that is called when the user exits the API. The function takes two parameters:

err - An error object, if an error occurred during the connection process.

metadata - contains additional information about the connection, such as the bank name and institution ID.