1.2.0 • Published 2 months ago

pipwave-ekyc-sdk v1.2.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
2 months ago

Project Name

Pipwave eKYC SDK for Javascript

Description

Welcome to the Pipwave eKYC SDK for JavaScript! This readme serves as your comprehensive guide to seamlessly integrate eKYC into your client app. Explore the Pipwave eKYC SDK's structure, delve into its extra features, and smoothly follow the installation process.

Implementing eKYC in your client app is simpler than ever. Just upload identity documents, submit a selfie, and effortlessly retrieve or update verification results.

Installation

Begin your journey with the Pipwave eKYC SDK using either the Npm or Yarn package manager.

Npm To install the Pipwave eKYC SDK via npm, ensure Node.js is on your system, and execute this command:

 $ npm install pipwave-ekyc-sdk

Yarn To install the SDK with Yarn, execute this command:

 $ yarn add pipwave-ekyc-sdk

Alternatively, if you prefer not to use a package manager, you can manually download the latest Pipwave eKYC SDK for JavaScript from the provided repository link:

For manual download, include the SDK in your project using this script tag:

<script src="/your-own-path-to-sdk/PwEkyc.min.js"></script>

Usage

Kickstart your eKYC journey with the Pipwave eKYC SDK by initializing it at the outset of your project. All that's required is your Access Token to get started. Here's how:

import { PWSDK } from "pw-ekyc-web-sdk";

const pwInstance = new PWSDK();
await pwInstance.init(YOUR_ACCESS_TOKEN)

SDK Documentation

Once the Pipwave eKYC SDK is initialized, you can unlock its full potential by making use of its properties and functionalities. The SDK supports two vital verification types: Identity Document and Selfie.

Properties

1. Verification Types

Retrieve the verification types which a user requires to perform eKYC on, by using the following code:

const types = pwInstance.verificationTypes
Output

The result is an array of string with the following possible values:

  • national_identity_document
  • selfie

2. Default Issuing Country

Retrieve the default country using the following code:

const country = pwInstance.defaultCountry
Output

The result is a Country object with the following properties: | Property | Description | |--|--| | isocode | Country code in ISO2 format (Example: my, id) | | name | Full name of Country (Example: Malaysia, Indonesia)_ |

3. Issuing Country List

Retrieve all issuing countries in ISO2 format:

const issuingCountries = pwInstance.issuingCountries
Output

The result is an array of Country objects. Refer to the Country for more details.

4. Full Country List

Retrieve all countries in ISO2 format:

const countries = pwInstance.countries
Output

The result is an array of Country objects. Refer to the Country for more details.

Methods

1. Upload Identity Document

To upload an identity document, just provide a properly configured UploadDocParam object as an argument to the uploadDoc() method. Here's how:

const param = {
	front_doc_base64: YOUR_FRONT_DOC;
	back_doc_base64: YOUR_BACK_DOC;
	doc_type: YOUR_DOC_TYPE;
	issuing_country: YOUR_COUNTRY_ISO;
}
const result = await pwInstance.uploadDoc(param);
UploadDocParam
ParameterDescription
front_doc_uriURI of the cropped front eKYC image, without the background
front_doc_uri_fullURI of the full front eKYC image, including background
back_doc_uriURI of the cropped back eKYC image, without the background
back_doc_uri_fullURI of the full back eKYC image, including background
front_doc_base64Cropped front eKYC image in base64 format, without the background
front_doc_base64_fullFull front eKYC image in base64 format, including background
back_doc_base64Cropped Back eKYC image in base64 format, without the background
back_doc_base64_fullFull Back eKYC image in base64 format, including background
doc_typeType of the document. (Possible values: passport, national_identity_document, driving_license)
issuing_country***ISO2 country code corresponding to the doc_type
Output
PropertyDescription
front_document_idUnique ID of the front document
back_document_idUnique ID of the back document

* For available issuing countries, please refer to the default issuing country and issuing country list. These resources will provide you with comprehensive information on the valid options you can use when specifying the issuing country** for your identity documents.

2. Upload Selfie

To upload a selfie, provide a properly configured UploadSelfieParam object as an argument to the uploadSelfie() method:

const param = {
	selfie_base64: YOUR_SELFIE;
	liveness_score: YOUR_LIVENESS_SCORE;
}
const result = await pwInstance.uploadSelfie(param);
UploadSelfieParam
ParameterDescription
selfie_uriURI of the cropped Selfie eKYC image, without background
selfie_uri_fullURI of the full Selfie eKYC image, including background
selfie_base64Cropped Selfie eKYC image in base64 format, without background
selfie_base64_fullFull Selfie eKYC image in base64 format, including background
liveness_scoreFacial liveness detection score (Sample value: 0.623)
Output
PropertyDescription
selfie_document_idUnique ID of the selfie document

3. Retrieve Verification Results

After completed the Upload Verification process, retrieve the verification results using the viewResult() method. No arguments are required for this method:

const result = await pwInstance.viewResult();
Output
PropertyDescription
statusStatus of all verification documents (Possible values: pending, approved, rejected, review)
is_retriableIndicates if the verification process can be retried
id_statusStatus of Identity document verification (Possible values: pending, approved, rejected, review)
selfie_statusStatus of selfie verification (Possible values: pending, approved, rejected, review)
result(Refer to DocResults)
DocResults
PropertyDescription
full_nameFull name captured from the Identity document
given_nameGiven name captured from the Identity document
surnameSurname captured from the Identity document
id_numberIdentity number captured from the Identity document
date_of_birthDate of birth captured from the Identity document
genderGender from the Identity document (Possible values: FEMALE, MALE)
line1First line of the address
cityCity of the address
zipZip code of the address
state_iso***State/region of the country in ISO2 format (Example: MY-01)
state_nameState/region name of the country
country_iso2***Country code in ISO2 format (Example: my, id)
country_nameCountry name

*** For available states and countries, please refer to the state/region list and country list. These resources will provide you with comprehensive information on the valid options you can use when specifying the state and country.

4. Update Verification Result

After retrieving the verification results, you can update them using the updateForm() method. Pass a properly configured UpdateFormParam object to update the results:

const param = {
	full_name: YOUR_FULL_NAME,
	id_number: YOUR_ID_NUMBER,
	date_of_birth: YOUR_DATE_OF_BIRTH,
	address: YOUR_ADDRESS,
	...
};
const result = await pwInstance.updateForm(param);
UpdateFormParam
PropertyDescription
full_name***Full name captured from the Identity document
given_name***Given name captured from the Identity document
surname***Surname captured from the Identity document
id_numberIdentity number captured from the Identity document
date_of_birthDate of birth captured from the Identity document
genderGender from the Identity document (Possible values: FEMALE, MALE)
line1First line of the address
cityCity of the address
zipZip code of the address
state_iso***State/region of the country in ISO2 format (Example: MY-01)
country_iso2***Country code in ISO2 format (Example: my, id)

*** Either full_name is required, or both given_name and surname are required.

Output
PropertyDescription
resultStatus of update verification result (Possible values: true, false)

5. Retrieve State / Region List

Retrieve the states by passing the country code in ISO2 format as an argument to the fetchStates() method:

const states = await pwInstance.fetchStates(YOUR_COUNTRY_ISO);
Output
PropertyDescription
iso_codeState/region of the country in ISO2 format (Example: MY-01)
nameFull name of state (Example: Selangor, Kuala Lumpur)

Acknowledgements

We extend our gratitude to the following open-source projects that greatly contributed to the development of the Pipwave eKYC SDK: webpack, axios, jwt-decode

Thank you to these remarkable projects and their dedicated teams for making our SDK possible. Your efforts are truly appreciated.

1.2.0

2 months ago

1.1.0

3 months ago

1.0.2

3 months ago

1.0.1

4 months ago

1.0.0

4 months ago

0.0.1-beta.7

4 months ago

0.0.1-beta.6

5 months ago

0.0.1-beta.5

5 months ago

0.0.1-beta.4

8 months ago

0.0.1-beta.3

9 months ago

0.0.1-beta.2

9 months ago

0.0.1-beta.1

9 months ago

0.0.1-beta.0

9 months ago