react-native-kalapa-ekyc 1.1.3 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,195 +1,591 @@
1
- # react-native-kalapa-ekyc
1
+ # Kalapa eKYC React Native SDK Documentation
2
2
 
3
- React Native SDK for Kalapa eKYC integration, providing a seamless way to implement eKYC functionality in your React Native applications.
3
+ Complete guide for integrating Kalapa eKYC functionality into your React Native applications.
4
+ ---
5
+ ## Changelog
4
6
 
5
- ## Installation
7
+ ### 1.2.1
8
+ - **successColor / failureColor**: Now can be configured via sdkConfig
9
+ ### 1.2.0
10
+ - **Documentation**: Complete overhaul of KalapaResult class documentation
11
+ - **Documentation**: Added comprehensive property documentation for all root-level fields
12
+ - **Documentation**: Added AddressEntities, MrzData, and QrCode object documentation
13
+ - **Documentation**: Enhanced usage examples with all available properties
14
+ - **Documentation**: Fixed package name references throughout documentation
15
+ - **Documentation**: Added examples for accessing MRZ data, QR code data, and address entities
6
16
 
7
- Using npm:
8
- ```bash
9
- npm install react-native-kalapa-ekyc
17
+ ### 1.1.3
18
+ - **Android**: Removed GIF dependencies to satisfy Google Play requirement (16KB pages size)
19
+ - **Stable version**
20
+
21
+ ### 1.1.2
22
+ - **Android**: Removed unnecessary jitpack.io repository
23
+ - **Android**: Updated animation to avoid GIF usage
24
+
25
+ ### 1.1.1
26
+ - **Android**: Removed unnecessary jcenter repository
27
+
28
+ ### 1.1.0
29
+ - **Android**: Support target SDK version 35 & edge-to-edge display
30
+ - **Android**: Support base64 library
31
+ - **UI & UX**: General optimization improvements
32
+
33
+ ### 1.0.7
34
+ - **General**: Applied new flow for both Android & iOS platforms
35
+ - **iOS**: UI & UX optimization
36
+ - **Android**: UI & UX optimization
37
+
38
+ ---
39
+
40
+ ## Requirements
41
+
42
+ ### React Native
43
+
44
+ ```json
45
+ "react": "17.0.2"
46
+ "react-native": "0.66.3"
10
47
  ```
11
48
 
12
- Using yarn:
13
- ```bash
14
- yarn add react-native-kalapa-ekyc
49
+ ### Android
50
+
51
+ **Minimum SDK Requirements:**
52
+ - `minSdkVersion = 24`
53
+ - `targetSdkVersion = 33`
54
+ - `android.useAndroidX = true`
55
+ - `Kotlin = 1.8.0+`
56
+
57
+ **Compile Options:**
58
+ ```xml
59
+ compileOptions {
60
+ sourceCompatibility JavaVersion.VERSION_1_8
61
+ targetCompatibility JavaVersion.VERSION_1_8
62
+ }
15
63
  ```
16
64
 
17
- ## iOS Setup
65
+ ### iOS
66
+
67
+ - iOS Development Target >= 13.4
68
+
69
+ ---
70
+
71
+ ## Getting Started
72
+
73
+ ### Install the SDK
74
+
75
+ #### Using Yarn
18
76
 
19
- Add the following to your Podfile:
20
- ```ruby
21
- pod 'react-native-kalapa-ekyc', :path => '../node_modules/react-native-kalapa-ekyc'
77
+ ```bash
78
+ yarn add react-native-kalapa-ekyc
22
79
  ```
23
80
 
24
- Then run:
81
+ #### Using npm
82
+
25
83
  ```bash
26
- cd ios && pod install
84
+ npm install react-native-kalapa-ekyc
27
85
  ```
28
86
 
29
- ## Basic Usage
87
+ #### Manual Installation
30
88
 
31
- ```typescript
32
- import KalapaEkyc from 'react-native-kalapa-ekyc';
33
-
34
- // Initialize the SDK
35
- const ekyc = new KalapaEkyc({
36
- clientId: 'YOUR_CLIENT_ID',
37
- clientSecret: 'YOUR_CLIENT_SECRET',
38
- environment: 'sandbox' // or 'production'
39
- });
40
-
41
- // Start eKYC flow
42
- try {
43
- const result = await ekyc.startEkyc();
44
- console.log('eKYC Result:', result);
45
- } catch (error) {
46
- console.error('eKYC Error:', error);
89
+ Add to your `app/package.json`:
90
+
91
+ ```json
92
+ "dependencies": {
93
+ "react-native-kalapa-ekyc": "^1.2.0"
47
94
  }
48
95
  ```
49
96
 
50
- ## WebView Integration
97
+ ---
51
98
 
52
- The SDK provides a WebView-based implementation:
99
+ ## iOS Configuration
53
100
 
54
- ```typescript
55
- import { WebViewScreen } from 'react-native-kalapa-ekyc';
56
-
57
- // In your navigation/component
58
- <WebViewScreen
59
- clientId="YOUR_CLIENT_ID"
60
- clientSecret="YOUR_CLIENT_SECRET"
61
- onComplete={(result) => {
62
- console.log('WebView eKYC completed:', result);
63
- }}
64
- onError={(error) => {
65
- console.error('WebView eKYC error:', error);
66
- }}
67
- />
68
- ```
101
+ ### Declare Camera and NFC Permissions
69
102
 
70
- ## API Reference
103
+ Update your `Info.plist` with the following:
71
104
 
72
- ### KalapaEkyc Class
105
+ ```xml
106
+ <key>NFCReaderUsageDescription</key>
107
+ <string>This eKYC app needs NFC reader to scan chip</string>
73
108
 
74
- #### Constructor Options
75
- ```typescript
76
- interface KalapaEkycOptions {
77
- clientId: string;
78
- clientSecret: string;
79
- environment: 'sandbox' | 'production';
80
- timeout?: number;
81
- language?: 'en' | 'vi';
82
- }
109
+ <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
110
+ <array>
111
+ <string>A0000002471001</string>
112
+ <string>A0000002472001</string>
113
+ <string>00000000000000</string>
114
+ </array>
115
+
116
+ <key>NSCameraUsageDescription</key>
117
+ <string>This eKYC app needs to use camera to scan document</string>
83
118
  ```
84
119
 
85
- #### Methods
120
+ ### Enable NFC Capability
86
121
 
87
- - `startEkyc()`: Starts the eKYC flow
88
- - `getSessionStatus(sessionId: string)`: Get status of an eKYC session
89
- - `validateSession(sessionId: string)`: Validate an eKYC session
122
+ Add the **Near Field Communication Tag Reading** capability to your project target in Xcode.
90
123
 
91
- ### WebViewScreen Component
124
+ [View Xcode capability documentation](https://help.apple.com/xcode/mac/current/#/dev88ff319e7)
92
125
 
93
- #### Props
94
- ```typescript
95
- interface WebViewScreenProps {
96
- clientId: string;
97
- clientSecret: string;
98
- onComplete: (result: EkycResult) => void;
99
- onError: (error: Error) => void;
100
- language?: 'en' | 'vi';
101
- theme?: 'light' | 'dark';
126
+ ---
127
+
128
+ ## Implementation Guide
129
+
130
+ ### 1. Initialize a Session
131
+
132
+ Each eKYC profile requires a unique session ID (JWT access token). The SDK uses this session ID to perform all eKYC steps.
133
+
134
+ **Important Notes:**
135
+ - Failure to provide a valid session ID results in an unauthorized error
136
+ - Sessions are valid for 10 minutes by default (adjustable)
137
+ - Each session ID should be used for a single eKYC flow
138
+
139
+ Check the [API documentation](https://www.notion.so/Init-session-820a772b8402499887e3cc983aaab148?pvs=21) for creating a new session.
140
+
141
+ ---
142
+
143
+ ### 2. Define SDK Configuration
144
+
145
+ #### Basic Configuration Structure
146
+
147
+ ```jsx
148
+ let configInfo = {
149
+ domain: <BASE_URL>,
150
+ main_color: <MAIN_COLOR>,
151
+ main_text_color: <MAIN_TEXT_COLOR>,
152
+ btn_text_color: <BTN_TEXT_COLOR>,
153
+ background_color: <BG_COLOR>,
154
+ success_color: <SUCCESS_COLOR>,
155
+ failure_color: <FAILURE_COLOR>,
156
+ language: <LANGUAGE>,
157
+ liveness_version: <LIVENESS_VERSION>,
158
+ face_data: <FACE_DATA>,
159
+ mrz: <INPUT_MRZ>,
160
+ qr_code: <INPUT_QR_CODE>,
161
+ allow_mrz_rescan_on_nfc_mismatch: <ALLOW_MRZ_RESCAN_ON_NFC_MISMATCH>
102
162
  }
103
163
  ```
104
164
 
105
- ## Response Types
165
+ #### Configuration Parameters
166
+
167
+ | Parameter | Type | Description |
168
+ |-----------|------|-------------|
169
+ | `BASE_URL` | String | Base URL for SDK API requests. Example endpoints: `<BASE_URL>/api/kyc/scan-front`, `<BASE_URL>/api/kyc/scan-back` |
170
+ | `BG_COLOR` | String | Hex color code for SDK background |
171
+ | `MAIN_COLOR` | String | Hex color code for buttons and functional texts |
172
+ | `MAIN_TEXT_COLOR` | String | Hex color code for main text elements |
173
+ | `BTN_TEXT_COLOR` | String | Hex color code for text inside filled buttons |
174
+ | `SUCCESS_COLOR` | String | Hex color code for text and view that indicated for success state |
175
+ | `FAILURE_COLOR` | String | Hex color code for text and view that indicated for failure state |
176
+ | `LIVENESS_VERSION` | Integer | Liveness detection version:<br/>• `3` - Requires 3 random actions (turn left/right/up/down, tilt left/right)<br/>• `2` - Move face towards camera<br/>• `1` - No action required |
177
+ | `LANGUAGE` | String | UI language: `"vi"` (Vietnamese) or `"en"` (English) |
178
+ | `FACE_DATA` | String | Base64 face data. If valid, skips liveness step and uses this for comparison with NFC portrait or document portrait |
179
+ | `INPUT_MRZ` | String | Pre-filled MRZ data. If valid, skips MRZ scan step. Invalid input throws `INVALID_MRZ` error |
180
+ | `INPUT_QR_CODE` | String | Pre-filled QR code. If valid, skips QR scan step. Invalid input throws `INVALID_QR` error |
181
+ | `ALLOW_MRZ_RESCAN_ON_NFC_MISMATCH` | Boolean | If `true`, allows user to rescan MRZ when chip data doesn't match input MRZ |
182
+
183
+ ---
184
+
185
+ ### 3. Define the SDK Flow
186
+
187
+ #### Available eKYC Steps
188
+
189
+ 1. Scan the document
190
+ 2. Scan the face
191
+ 3. Scan the NFC chip
192
+
193
+ #### Flow Types
194
+
195
+ | Flow Type | Scan Document | Scan Face | Scan NFC Chip |
196
+ |-----------|---------------|-----------|---------------|
197
+ | `ekyc` | ✓ | ✓ | ✗ |
198
+ | `nfc_ekyc` | ✓ | ✓ | ✓ |
199
+ | `nfc_only` | ✗ | ✓ | ✓ |
200
+
201
+ #### Flow Selection Guidelines
202
+
203
+ The SDK flow typically matches the flow set during session creation. However, there are special use cases:
204
+
205
+ **Example Use Case for `nfc_only`:**
206
+ If users completed the basic `ekyc` flow but failed to scan the NFC chip, you can:
207
+ - Reuse the same session ID
208
+ - Set flow to `nfc_only`
209
+ - Allow NFC chip scanning without re-scanning document and face
210
+
211
+ **Best Practice:** Use separate sessions for different flows to simplify data management.
212
+
213
+ ---
214
+
215
+ ### 4. Start the SDK
216
+
217
+ ```jsx
218
+ import KalapaEkyc, { KalapaResult } from 'react-native-kalapa-ekyc';
219
+
220
+ let sessionId = yourSessionInitFunc();
221
+ let sdkFlow = "<YOUR_SDK_FLOW>"; // ekyc / nfc_ekyc / nfc_only
222
+ let configInfo = {...};
223
+
224
+ KalapaEkyc.start(sessionId, sdkFlow, configInfo)
225
+ .then((rawResult) => {
226
+ try {
227
+ // You can use either the constructor or static method
228
+ const result = KalapaResult.fromRawResult(rawResult);
229
+ // Or: const result = new KalapaResult(rawResult);
230
+ handleSuccessfulResult(result);
231
+ } catch (error) {
232
+ console.error("Result parsing error:", error);
233
+ }
234
+ })
235
+ .catch((error) => {
236
+ switch (error.code) {
237
+ case "EXPIRED":
238
+ console.warn("Session expired:", error.message);
239
+ break;
240
+ case "CANCELED":
241
+ console.warn("User canceled:", error.message);
242
+ break;
243
+ case "PERMISSION_DENIED":
244
+ console.error("Permission denied:", error.message);
245
+ break;
246
+ case "DEVICE_NOT_ACCEPTABLE":
247
+ console.error("Device not acceptable:", error.message);
248
+ break;
249
+ case "MRZ_INVALID":
250
+ console.error("Invalid MRZ:", error.message);
251
+ break;
252
+ case "NFC_NOT_MATCH":
253
+ console.error("NFC mismatch:", error.message);
254
+ break;
255
+ case "UNSUPPORTED":
256
+ console.error("Unsupported device:", error.message);
257
+ break;
258
+ case "CONFIG_ERROR":
259
+ console.error("Configuration error:", error.message);
260
+ break;
261
+ case "OTHER":
262
+ default:
263
+ console.error("Unknown error:", error.message);
264
+ break;
265
+ }
266
+ });
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Exception Handling
272
+
273
+ ### Error Codes
274
+
275
+ | Error Code | Description |
276
+ |------------|-------------|
277
+ | `EXPIRED` | Session expired (10 minutes timeout) |
278
+ | `CANCELED` | User canceled the eKYC process |
279
+ | `PERMISSION_DENIED` | Camera or NFC permission denied |
280
+ | `DEVICE_NOT_ACCEPTABLE` | Emulator, rooted, or jailbroken device detected |
281
+ | `MRZ_INVALID` | Input MRZ is invalid |
282
+ | `NFC_NOT_MATCH` | MRZ doesn't match NFC chip data |
283
+ | `UNSUPPORTED` | Device doesn't support required features (usually NFC) |
284
+ | `CONFIG_ERROR` | Configuration error |
285
+ | `OTHER` | Unexpected error |
286
+
287
+ ---
288
+
289
+ ## Result Objects
290
+
291
+ ### KalapaResult Class
292
+
293
+ The SDK provides a `KalapaResult` class for type-safe data access:
106
294
 
107
295
  ```typescript
108
- interface EkycResult {
109
- sessionId: string;
110
- status: 'completed' | 'pending' | 'failed';
111
- data?: {
112
- idCard?: IdCardData;
113
- face?: FaceData;
114
- verification?: VerificationResult;
115
- };
116
- }
296
+ import { KalapaResult } from 'react-native-kalapa-ekyc';
117
297
 
118
- interface IdCardData {
119
- type: string;
120
- number: string;
121
- name: string;
122
- dob: string;
123
- // ... other ID card fields
124
- }
298
+ // Create instance using static method (recommended)
299
+ const result = KalapaResult.fromRawResult(rawResult);
300
+
301
+ // Or use constructor directly
302
+ const result = new KalapaResult(rawResult);
125
303
  ```
126
304
 
127
- ## Error Handling
305
+ #### Core Properties
306
+
307
+ | Property | Type | Description |
308
+ |----------|------|-------------|
309
+ | `decision` | DecisionType | Decision result: `"APPROVED"`, `"MANUAL"`, `"REJECTED"`, or `"UNKNOWN"` |
310
+ | `selfie_data` | SelfieData | Face matching results |
311
+ | `nfc_data` | NfcData | NFC chip data |
312
+ | `session` | string | Session JWT token |
313
+ | `rawResult` | any | Original unprocessed response |
314
+
315
+ #### Root-Level Personal Information
128
316
 
129
- The SDK throws typed errors that you can handle:
317
+ | Property | Type | Description |
318
+ |----------|------|-------------|
319
+ | `name` | string | Full name from the verification result |
320
+ | `id_number` | string | ID card number |
321
+ | `birthday` | string | Birth date |
322
+ | `gender` | string | Gender information |
323
+ | `country` | string | Country information |
324
+ | `national` | string | Nationality |
325
+ | `ethnicity` | string | Ethnicity information |
326
+ | `religion` | string | Religious information |
327
+ | `features` | string | Personal identification marks or features |
328
+ | `poi` | string | Place of issue |
329
+
330
+ #### Date Information
331
+
332
+ | Property | Type | Description |
333
+ |----------|------|-------------|
334
+ | `doe` | string | Date of expiry |
335
+ | `doi` | string | Date of issuance |
336
+
337
+ #### Address Information
338
+
339
+ | Property | Type | Description |
340
+ |----------|------|-------------|
341
+ | `home` | string | Home address (full text) |
342
+ | `home_entities` | AddressEntities | Parsed home address entities (district, ward, province, unknown) |
343
+ | `resident` | string | Residential address (full text) |
344
+ | `resident_entities` | AddressEntities | Parsed residential address entities (district, ward, province, unknown) |
345
+
346
+ #### Document Data
347
+
348
+ | Property | Type | Description |
349
+ |----------|------|-------------|
350
+ | `mrz_data` | MrzData \| null | Machine Readable Zone data with parsed fields |
351
+ | `qr_code` | QrCode \| null | QR code data from document |
352
+ | `type` | string | Document type |
353
+
354
+ ---
355
+
356
+ ### SelfieData Object
357
+
358
+ #### Properties
359
+
360
+ | Property | Type | Description |
361
+ |----------|------|-------------|
362
+ | `is_matched` | boolean | Face matching result |
363
+ | `matching_score` | number | Matching confidence score (0-100) |
364
+
365
+ #### Usage Example
130
366
 
131
367
  ```typescript
132
- try {
133
- await ekyc.startEkyc();
134
- } catch (error) {
135
- if (error instanceof KalapaEkycError) {
136
- // Handle SDK-specific errors
137
- console.error(error.code, error.message);
138
- } else {
139
- // Handle other errors
140
- console.error(error);
141
- }
368
+ if (result.selfie_data.is_matched) {
369
+ console.log(`Face matched with ${result.selfie_data.matching_score}% confidence`);
142
370
  }
143
371
  ```
144
372
 
145
- ## Configuration Options
373
+ ---
146
374
 
147
- | Option | Type | Description | Default |
148
- |--------|------|-------------|---------|
149
- | clientId | string | Your Kalapa client ID | Required |
150
- | clientSecret | string | Your Kalapa client secret | Required |
151
- | environment | string | 'sandbox' or 'production' | 'sandbox' |
152
- | timeout | number | Request timeout in ms | 30000 |
153
- | language | string | 'en' or 'vi' | 'en' |
375
+ ### NfcData Object
154
376
 
155
- ## Development
377
+ #### Personal Information
156
378
 
157
- 1. Clone the repository
158
- 2. Install dependencies:
159
- ```bash
160
- yarn install
161
- ```
162
- 3. Run the example app:
163
- ```bash
164
- yarn example
165
- ```
379
+ | Property | Type | Description |
380
+ |----------|------|-------------|
381
+ | `name` | string | Full name from NFC chip |
382
+ | `id_number` | string | ID card number |
383
+ | `old_id_number` | string | Previous ID number (if any) |
384
+ | `date_of_birth` | string | Birth date in DD/MM/YYYY format |
385
+ | `date_of_expiry` | string | ID expiry date in DD/MM/YYYY format |
386
+ | `date_of_issuance` | string | ID issuance date in DD/MM/YYYY format |
387
+ | `gender` | string | Gender information |
388
+ | `nationality` | string | Nationality |
389
+ | `nation` | string | Nation/ethnicity information |
166
390
 
167
- ## Contributing
391
+ #### Address Information
168
392
 
169
- See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
393
+ | Property | Type | Description |
394
+ |----------|------|-------------|
395
+ | `address` | string | Current residential address |
396
+ | `hometown` | string | Hometown/place of origin |
170
397
 
171
- ## License
398
+ #### Family Information
172
399
 
173
- MIT
400
+ | Property | Type | Description |
401
+ |----------|------|-------------|
402
+ | `father_name` | string | Father's full name |
403
+ | `mother_name` | string | Mother's full name |
404
+ | `spouse_name` | string | Spouse's full name |
174
405
 
175
- ## Support
406
+ #### Additional Information
176
407
 
177
- For support, please contact [support@kalapa.vn](mailto:support@kalapa.vn) or visit our [documentation](https://docs.kalapa.vn).
408
+ | Property | Type | Description |
409
+ |----------|------|-------------|
410
+ | `religion` | string | Religious information |
411
+ | `personal_identification` | string | Personal identification marks or features |
178
412
 
179
- ## Changelog
180
- ** 1.0.7
181
- - General: Apply new flow for both Android & iOS
182
- - iOS: UI & UX optimization
183
- - Android: UI & UX optimization
184
- ** 1.1.0
185
- - Android: Support target version sdk 35 & edge to edge
186
- - Android: Support base64 library
187
- - UI & UX optimize
188
- ** 1.1.1
189
- - Android: Remove unnecesary jcenter
190
- ** 1.1.2
191
- - Android: Remove unnecesary jitpack.io
192
- - Android: Update animation avoid gif
193
- - Stable version
194
- ** 1.1.3
195
- - Android: Remove gif dependencies to sastify the google play requirement (16KB pages size)
413
+ #### Technical Data
414
+
415
+ | Property | Type | Description |
416
+ |----------|------|-------------|
417
+ | `face_image` | string | Base64 encoded face image from NFC chip |
418
+ | `mrz` | string | Machine Readable Zone data (raw string) |
419
+
420
+ ---
421
+
422
+ ### AddressEntities Object
423
+
424
+ Represents parsed address components:
425
+
426
+ | Property | Type | Description |
427
+ |----------|------|-------------|
428
+ | `district` | string | District name |
429
+ | `ward` | string | Ward name |
430
+ | `province` | string | Province name |
431
+ | `unknown` | string | Unparsed address components |
432
+
433
+ ---
434
+
435
+ ### MrzData Object
436
+
437
+ Contains MRZ (Machine Readable Zone) information:
438
+
439
+ | Property | Type | Description |
440
+ |----------|------|-------------|
441
+ | `data` | MrzDataFields \| undefined | Parsed MRZ fields |
442
+ | `error` | MrzDataError \| undefined | Error information if parsing failed |
443
+
444
+ #### MrzDataFields
445
+
446
+ | Property | Type | Description |
447
+ |----------|------|-------------|
448
+ | `birthday` | string \| undefined | Birth date from MRZ |
449
+ | `doe` | string \| undefined | Date of expiry from MRZ |
450
+ | `gender` | string \| undefined | Gender from MRZ |
451
+ | `id_number` | string \| undefined | ID number from MRZ |
452
+ | `name` | string \| undefined | Name from MRZ |
453
+ | `raw_mrz` | string \| undefined | Raw MRZ string |
454
+
455
+ #### MrzDataError
456
+
457
+ | Property | Type | Description |
458
+ |----------|------|-------------|
459
+ | `code` | number | Error code |
460
+ | `message` | string | Error message |
461
+
462
+ ---
463
+
464
+ ### QrCode Object
465
+
466
+ Contains QR code information:
467
+
468
+ | Property | Type | Description |
469
+ |----------|------|-------------|
470
+ | `data` | QrCodeData \| undefined | Decoded QR code data |
471
+ | `error` | { code: number, message: string } \| undefined | Error information if decoding failed |
472
+
473
+ #### QrCodeData
474
+
475
+ | Property | Type | Description |
476
+ |----------|------|-------------|
477
+ | `decoded_text` | string \| undefined | Decoded QR code text |
478
+ | `stage` | number \| undefined | Processing stage |
479
+
480
+ ---
481
+
482
+ ## Convenience Methods
483
+
484
+ ### Decision Methods
485
+
486
+ | Method | Returns | Description |
487
+ |--------|---------|-------------|
488
+ | `isApproved()` | boolean | Returns `true` if decision is `"APPROVED"` |
489
+ | `isManualReview()` | boolean | Returns `true` if decision is `"MANUAL"` |
490
+ | `isRejected()` | boolean | Returns `true` if decision is `"REJECTED"` |
491
+
492
+ ### Face Matching Methods
493
+
494
+ | Method | Returns | Description |
495
+ |--------|---------|-------------|
496
+ | `isFaceMatched()` | boolean | Returns `true` if face matched successfully |
497
+ | `getFaceMatchingScore()` | number | Returns face matching confidence score |
498
+
499
+ ### Formatted Getters
500
+
501
+ | Method | Returns | Description |
502
+ |--------|---------|-------------|
503
+ | `getDisplayName()` | string | Returns formatted name or `"N/A"` if empty |
504
+ | `getIdNumber()` | string | Returns formatted ID number or `"N/A"` if empty |
505
+ | `getDateOfBirth()` | string | Returns formatted birth date or `"N/A"` if empty |
506
+ | `getFaceImage()` | string | Returns base64 face image from NFC chip |
507
+
508
+ ### Utility Methods
509
+
510
+ | Method | Returns | Description |
511
+ |--------|---------|-------------|
512
+ | `toJSON()` | object | Returns clean object for storage/transmission |
513
+ | `fromRawResult(rawResult)` | KalapaResult | Static method to create KalapaResult from raw response |
514
+
515
+ ---
516
+
517
+ ## Complete Usage Example
518
+
519
+ ```typescript
520
+ import KalapaEkyc, { KalapaResult } from 'react-native-kalapa-ekyc';
521
+
522
+ const handleEkyc = async () => {
523
+ try {
524
+ const rawResult = await KalapaEkyc.start(sessionId, "nfc_only", configInfo);
525
+ const result = KalapaResult.fromRawResult(rawResult);
526
+
527
+ // Check decision
528
+ if (result.isApproved()) {
529
+ console.log("eKYC Approved");
530
+ } else if (result.isManualReview()) {
531
+ console.log("Manual review required");
532
+ }
533
+
534
+ // Check face matching
535
+ if (result.isFaceMatched()) {
536
+ console.log(`Face matched: ${result.getFaceMatchingScore()}%`);
537
+ }
538
+
539
+ // Access root-level data
540
+ console.log(`Name: ${result.name}`);
541
+ console.log(`ID Number: ${result.id_number}`);
542
+ console.log(`Birthday: ${result.birthday}`);
543
+
544
+ // Access NFC data
545
+ const userData = {
546
+ name: result.nfc_data.name,
547
+ idNumber: result.nfc_data.id_number,
548
+ birthDate: result.nfc_data.date_of_birth,
549
+ faceImage: result.nfc_data.face_image
550
+ };
551
+
552
+ // Access address entities
553
+ if (result.home_entities) {
554
+ console.log(`Home: ${result.home_entities.province}, ${result.home_entities.district}`);
555
+ }
556
+
557
+ // Access MRZ data if available
558
+ if (result.mrz_data?.data) {
559
+ console.log(`MRZ Name: ${result.mrz_data.data.name}`);
560
+ console.log(`Raw MRZ: ${result.mrz_data.data.raw_mrz}`);
561
+ }
562
+
563
+ // Access QR code data if available
564
+ if (result.qr_code?.data) {
565
+ console.log(`QR Code: ${result.qr_code.data.decoded_text}`);
566
+ }
567
+
568
+ // Export to JSON for storage/transmission
569
+ const jsonData = result.toJSON();
570
+ await saveUserData(jsonData);
571
+
572
+ } catch (error) {
573
+ handleEkycError(error);
574
+ }
575
+ };
576
+ ```
577
+
578
+ ---
579
+
580
+ ## Summary
581
+
582
+ The Kalapa eKYC React Native SDK provides comprehensive identity verification with document scanning, face matching, and NFC chip reading capabilities. Key features include:
583
+
584
+ - Three flexible flow types for different verification needs
585
+ - Customizable UI with color and language options
586
+ - Multiple liveness detection versions
587
+ - Type-safe result objects with convenience methods
588
+ - Robust error handling with detailed error codes
589
+ - Support for pre-filled data to skip certain steps
590
+
591
+ For API documentation and session creation, refer to the [Kalapa API documentation](https://kalapa-no.notion.site/eKYC-API-SDK-document-2a2a4ccfa1184a789cb4513fade351e4?pvs=74)