React Native SDK

The React Client SDK helps user submit their bank statements via upload or net banking credentials in your React application.

See BankConnect in action#

The demo video below shows how a user submit bank statement using net banking credentials:

The video below shows a user submit bank statement by uploading the PDF file:

Integration Workflow#

The diagram below illustrates the integration workflow in a nutshell:

Client SDK Workflow

Sample Project#

We have hosted a sample project on GitHub, you can check it out here:

Including the library#

The library is available as an npm package. To install the dependency

npm install finbox-bank-connect-js
yarn add finbox-bank-connect-js

After installing this, you have to install an additional dependency, you can skip this if its already part of your project:

npm install styled-components
```sh yarn add styled-components ```
## Adding the BankConnect Component

Once the dependency is added. You can use a BankConnect view anywhere in your component. Since the SDK opens a modal it is recommended to add it to the top hierarchy of you View.

<FinBoxBankConnect
linkId="<LINK_ID>"
apiKey="<FINBOX_API_KEY>"
onExit="<EXIT_CALLBACK>"
onSuccess="<UPLOAD_SUCCESS_CALLBACK>" />
AttributeDescriptionRequired
linkIdunique identifier for the user. The view will not work if linkId is not specifiedYes
apiKeyholds the unique API Key provided.Yes
onExitspecifies the callback when the user exits the SDKNo, but recommended
onSuccessspecifies the callback when the document has been successfully uploaded.No, but recommended
onErrorspecifies the callback when an error occurredNo, but recommended
fromDate and toDatespecifies the time period for which the statements will be fetched. If not provided the default date range is 6 months from the current date. Its format should be in dd/MM/yyyy.No
bankNamepass the bank identifier to skip the bank selection screen and directly open a that bank's screen insteadNo

fromDate and toDate specify the period for which the statements will be fetched. For example, if you need the last 6 months of statements, fromDate will be today's date - 6 months and toDate will be today's date - 1 day. If not provided the default date range is 6 months from the current date. It should be in dd/MM/yyyy format.

Period Values
  • Please make sure fromDate is always less than toDate
  • Make sure toDate is never today's date, the maximum possible value for it is today's date - 1 day

Callback#

This section lists the different callbacks:

Success#

onSuccess function will be called when the document has been successfully uploaded.

const onSuccess = (payload) => {
console.log("Payload", payload)
}

payload object will have following structure:

{
"entityId": "1d1f-sfdrf-17hf-asda",
"linkId": "link_id"
}
KeyDescription
entityIdUnique identifier used for fetching statement data
linkIdIdentifier passed while initializing the SDK

Exit#

OnExit function will be called when the user exits the SDK.

const onExit = (payload) => {
console.log("Payload", payload)
}

payload object will have following structure:

{
"linkId": "link_id"
}
KeyDescription
linkIdIdentifier passed while initializing the SDK

Error#

OnError function will be called whenever any error occurs in the user flow.

const onError = (payload) => {
console.log("Payload", payload)
}

payload object will have following structure:

{
"linkId": "link_id",
"error_type": "MUXXX",
"reason": "Reason for failure"
}
KeyDescription
linkIdIdentifier passed while initializing the SDK
reasonReason for failure
Webhook

To track additional errors, and transaction process completion at the server-side, it is recommended to also integrate Webhook.

Error types#

In case of Error, error_type of MUXXX implies an error in Manual PDF Upload and NBXXX implies its from Netbanking.

Caseerror_typeSample payload
Trial Expired for Dev CredentialsMU002{"reason:"Trial Expired for Dev Credentials",linkID:"<USER_ID_PASSED>","error_type":"MU002"}
PDF Password IncorrectMU003{"reason:"Password Incorrect",linkID:"<USER_ID_PASSED>","error_type":"MU003"}
Specified bank doesn't match with detected bankMU004{"reason:"Not axis statement",linkID:"<USER_ID_PASSED>","error_type":"MU004"}
Non Parsable PDF - PDF file is corrupted or has no selectable text (only scanned images)MU006{"reason:"",linkID:"<USER_ID_PASSED>","error_type":"MU006"}
Not a valid statement or bank is not supportedMU020{"reason:"Not a valid statement or bank is not supported",linkID:"<USER_ID_PASSED>","error_type":"MU020"}
Invalid Date RangeMU021{"reason:"Please upload statements within the date range fromDate to toDate",linkID:"<USER_ID_PASSED>","error_type":"MU021"}
NetBanking FailedNB000{"reason:"failure_message",linkID:"<USER_ID_PASSED>","error_type":"NB000"}
Netbanking Login ErrorNB003{"reason:"failure_message",linkID:"<USER_ID_PASSED>","error_type":"NB003"}
Captcha ErrorNB004{"reason:"Invalid Captcha",linkID:"<USER_ID_PASSED>","error_type":"NB004"}
Security ErrorNB005{"reason:"failure_message",linkID:"<USER_ID_PASSED>","error_type":"NB005"}

Events#

Android and JS events are passed which can used for purposes such as analytics.The object passed is of the following format.

{
"status":"<EVENT_NAME>",
"data":"EXTRA_INFO"
}
Eventstatusdata
Bank selectedbank_selected<BANK NAME>
Manual upload screen openedmanual-
Clicked back in Manual Uploadmanual_upload_back-
Clicked back in Netbankingnet_banking_back-

Above Events can be recieved in two ways

  1. Listen to window postMessage via target.addEventListener("message", (event) =>{});
  1. In case the SDK is used in a Android WebView. A Javascript Interface can be used to get the events.
  • Interface Name: BankConnectAndroid
  • Callback Function: onResult.