React Native
FinBox Lending SDK is a drop-in module that can add a digital lending journey to any mobile application.
Setting up the bridge#
Install the React SDK from the npm package:
Now to auto link this native module to your app, run following command:
Once the linking is done you need to open Android Studio and add a maven repository url in your project level
build.gradlefileSpecify the following in
local.propertiesfile:Following keys will be shared by the FinBox team:
- ACCESS_KEY & SECRET_KEY - These keys will give access to the AWS bucket to fetch SDK
- LENDING_SDK_VERSION - Middleware Lending SDK version
- RISK_SDK_VERSION - Device Connect SDK version
- ENVIRONMENT - SDK environment supports [
uat&prod]
Final change required is in the
MainApplicationclass of your native app.Minimum SDK Version Lending SDK supports a minimum SDK version of 21. So please update the minimum SDK version to 21
Start SDK flow#
Once all dependencies are added, SDK requires 3 inputs: customer_id, user_token and client_api_key.
Note
user_token needs to be generated against a customer_id on backend before starting the SDK. Refer here
Now that all required parameters are available, we can start the SDK flow as follows:
Credit Line#
In case of credit line product, once the lending journey is completed, user can opt-in for a credit while doing a transaction. For such a case use following method to start the credit line withdrawl journey:
| Field | Type | Description |
|---|---|---|
WITHDRAW_AMOUNT | Float | indicates the amount that a user is trying to withdraw |
TRANSACTION_ID | String | will hold the transaction id for the withdrawal flow |
Callback#
There are 2 callbacks that needs to be handled.
successCallback#
Success Callback will have a resultCode. Possible values for resultCode are as follows:
| Result Code | Description | |
|---|---|---|
MW200 | Journey is completed successfully | |
MW500 | User exits the journey | |
MW400 | Some error occurred in the SDK | |
CL200 | Credit line withdrawal success | |
CL500 | Credit line withdrawal failed |
errorCallback#
Error callback will contain the error message.
Notifications#
FinBox Lending SDK sends notifications of its own for mandatory events. It is expected that the client app has Firebase configured and can forward the notification payload to the SDK. In order for SDK to capture the notifications add the following:
Customizations#
- The privacy policy URL needs to be updated to the company policy. The default privacy policy is pointing to FinBox privacy. Add a String resource to specify the policy URL.
Note
Make sure the value passed is a valid URL
- The toolbar title can be updated which will be visible in the Dashboard module. In order to update the toolbar just add a String resource for the same.
- SDK fonts can be customised to match the parent application. The SDK used 3 main fonts as mentioned below:
FBLendingAppTheme.FinBox.TextPrimaryis used for all buttons and bold headersFBLendingAppTheme.FinBox.TextSecondaryis the regular font that is used for regular textFBLendingAppTheme.FinBox.TextSubHeadis the medium bold font that is used for Sections or subheadings
Customize the SDK font by adding the application fontFamily in the styles.
- SDK Buttons can be customized by overriding
FBLendingAppTheme
Change button corner radius and text font as per your application theme.