You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/bank-connect/javascript.md
+30-7
Original file line number
Diff line number
Diff line change
@@ -3,21 +3,25 @@ base_url: https://apis.bankconnect.finbox.in/bank-connect #base URL for the API
3
3
version: v1# version of API
4
4
---
5
5
# BankConnect: JavaScript
6
+
6
7
The JavaScript SDK helps user submit their bank statements via upload or net banking credentials in your Web applications. The SDK will be opened via a web URL.
7
8
8
9
The first step in integration involves calling the [Session API](/bank-connect/javascript.html#session-api)
9
10
Then the workflow can be implemented in one of the following ways:
11
+
10
12
-[Load in a new page with redirect URL](/bank-connect/javascript.html#redirect-workflow)
11
13
-[Embedding inside an Inline Frame (`<iframe>`)](/bank-connect/javascript.html#inline-frame-workflow)
12
14
13
15
## Session API
16
+
14
17
To start with the integration, call the following API to create a session:
15
18
16
19
::: tip Endpoint
17
20
POST **{{$page.frontmatter.base_url}}/{{$page.frontmatter.version}}/session/**
18
21
:::
19
22
20
23
### Parameters
24
+
21
25
| Name | Type | Description | Required | Default |
22
26
| - | - | - | - | - |
23
27
| link_id | string | link_id value | Yes | - |
@@ -40,25 +44,30 @@ POST **{{$page.frontmatter.base_url}}/{{$page.frontmatter.version}}/session/**
40
44
<b>Note</b>: If the `to-date` lies in the first week of the month, the respective month is not considered in the journey.
41
45
42
46
::: warning NOTE
47
+
43
48
-`redirect_url` in request is a compulsory field in [Redirect Workflow](/bank-connect/javascript.html#redirect-workflow) but is not required with the [Inline Frame workflow](/bank-connect/javascript.html#inline-frame-workflow)
44
49
- Please make sure `from_date` is always less than `to_date`
45
50
- Make sure `to_date` is never today's date, the maximum possible value for it is today's date - 1 day
46
51
:::
47
52
48
53
### Response
54
+
49
55
On successful API call, it gives a **200 HTTP code** with a response in following format:
- Create a session using [Session API](/bank-connect/javascript.html#session-api)
78
88
- Get the URL received from above API and embed it in an `<iframe>`
79
89
- You'll [receive callbacks](/bank-connect/javascript.html#receive-callbacks) by implementing an event listener. Based on the event you can close / hide the inline frame.
80
90
81
91
## Receive callbacks
92
+
82
93
1. To receive callbacks in `<iframe>` workflow, you need to implement an event listener. It can be implemented as follows:
83
94
84
95
```html
@@ -96,20 +107,25 @@ The flow for this involves the following steps:
96
107
```
97
108
98
109
2. To receive callbacks in `Android WebView`, a [Javascript Interface](https://developer.android.com/guide/webapps/webview#UsingJavaScript) can be used to get the events.
110
+
99
111
- Interface Name: `BankConnectAndroid`
100
112
- Callback Functions
101
-
- All Events: `onResult`
102
-
- Error: `onError`
103
-
- Exit: `onExit`
104
-
- Success: `onSuccess`
105
-
- Extra Info: `onInfo`
113
+
- All Events: `onResult`
114
+
- Error: `onError`
115
+
- Exit: `onExit`
116
+
- Success: `onSuccess`
117
+
- Extra Info: `onInfo`
106
118
107
119
### Event Object
120
+
108
121
The `event` object received by the listener can be one of the following:
122
+
109
123
#### Success
124
+
110
125
This is received when user completes the upload process.
111
126
112
127
1. Iframe
128
+
113
129
```js
114
130
{
115
131
type:"finbox-bankconnect",
@@ -124,6 +140,7 @@ This is received when user completes the upload process.
124
140
2. WebView
125
141
126
142
`BankConnectAndroid.onSuccess`
143
+
127
144
```js
128
145
{
129
146
"entityId":"1d1f-sfdrf-17hf-asda", //Unique ID that will used to fetch statement data
@@ -132,9 +149,11 @@ This is received when user completes the upload process.
132
149
```
133
150
134
151
#### Exit
152
+
135
153
This is received when user exits the SDK.
136
154
137
155
1. Iframe
156
+
138
157
```js
139
158
{
140
159
type:"finbox-bankconnect",
@@ -157,9 +176,11 @@ This is received when user exits the SDK.
157
176
```
158
177
159
178
#### Error
179
+
160
180
This is received whenever any error occurs in the user flow.
161
181
162
182
1. Iframe
183
+
163
184
```js
164
185
{
165
186
type:"finbox-bankconnect",
@@ -188,11 +209,12 @@ In case an error occurs, you'll receive `OnError` event payload, and then if the
188
209
:::
189
210
190
211
##### Error types
212
+
191
213
In case of Error, error_type of ```MUXXX``` implies an error in Manual PDF Upload and ```NBXXX``` implies its from Netbanking.
192
214
193
215
| Case | error_type | Sample payload|
194
216
| - | - | - |
195
-
| Trial Expired for Dev Credentials | MU002 |```{"reason:"Trial Expired for Dev Credentials",linkID:"<USER_ID_PASSED>","error_type":"MU002"}```|
217
+
| Trial Expired for Dev Credentials | MU002 |```{"reason:"Trial Expired for Dev Credentials",linkID:"<USER_ID_PASSED>","error_type":"MU002"}```|
196
218
| PDF Password Incorrect | MU003 |```{"reason:"Password Incorrect",linkID:"<USER_ID_PASSED>","error_type":"MU003"}```|
197
219
| Specified bank doesn't match with detected bank | MU004 |```{"reason:"Not axis statement",linkID:"<USER_ID_PASSED>","error_type":"MU004"}```|
198
220
| Non Parsable PDF - PDF file is corrupted or has no selectable text (only scanned images)| MU006 |```{"reason:"",linkID:"<USER_ID_PASSED>","error_type":"MU006"}```|
@@ -203,11 +225,12 @@ In case of Error, error_type of ```MUXXX``` implies an error in Manual PDF Uplo
0 commit comments