2.0.0 • Published 4 months ago

pipwave-ekyc-sdk v2.0.0

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
4 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.

Upgrading to version 2

Attention users! Please note that the following methods in the SDK have been renamed for better clarity and consistency:

  • uploadDoc is now renamed to uploadId
  • viewResult is now renamed to viewIdResult
  • updateForm is now renamed to updateIdForm

Please update your codebase accordingly to reflect these changes. Thank you for your understanding and cooperation.

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

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 3 vital verification types: Identity Document, Selfie, and Credit Card.

M/O/C:

  • M: Mandatory
  • C: Required when
  • O: Optional

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
  • cc
  • poa

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 UploadIdParam object as an argument to the uploadId() 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.uploadId(param);
UploadIdParam
ParameterM/O/CDescription
front_doc_uriCURI of the cropped front eKYC image, without the background. Required when front_doc_base64 is absent.
front_doc_uri_fullOURI of the full front eKYC image, including background.
back_doc_uriCURI of the cropped back eKYC image, without the background. Required when back_doc_base64 is absent.
back_doc_uri_fullOURI of the full back eKYC image, including background.
front_doc_base64CCropped front eKYC image in base64 format, without the background. Required when front_doc_uri is absent.
front_doc_base64_fullOFull front eKYC image in base64 format, including background.
back_doc_base64CCropped Back eKYC image in base64 format, without the background. Required when back_doc_uri is absent.
back_doc_base64_fullOFull Back eKYC image in base64 format, including background.
doc_typeMType of the document. (Possible values: passport, national_identity_document, driving_license).
issuing_countryMISO2 country code corresponding to the doc_type. For the list of valid options, refer to the default issuing country and issuing country list.
Output
PropertyDescription
front_document_idUnique ID of the front document.
back_document_idUnique ID of the back document.

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
ParameterM/O/CDescription
selfie_uriCURI of the cropped Selfie eKYC image, without background. Required when selfie_base64 is absent.
selfie_uri_fullOURI of the full Selfie eKYC image, including background.
selfie_base64CCropped Selfie eKYC image in base64 format, without background. Required when selfie_uri is absent.
selfie_base64_fullOFull Selfie eKYC image in base64 format, including background.
liveness_scoreMFacial liveness detection score. (Sample value: 0.623)
Output
PropertyDescription
selfie_document_idUnique ID of the selfie document.

3. Retrieve Id Verification Results

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

const result = await pwInstance.viewIdResult();
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 IdResults)
IdResults
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_isoState/region of the country in ISO2 format. For the available states, please refer to the state/region list. (Example: MY-01)
country_iso2Country code in ISO2 format. For the available countries, please refer to the country list. (Example: my, id)

4. Update Id Verification Result

After retrieving the id verification results, you can update them using the updateIdForm() method. Pass a properly configured UpdateIdFormParam 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.updateIdForm(param);
UpdateIdFormParam
ParameterM/O/CDescription
full_nameCFull name captured from the Identity document. Required when given_name and surname are absent.
given_nameCGiven name captured from the Identity document. Required when full_name is absent.
surnameCSurname captured from the Identity document. Required when full_name is absent.
id_numberMIdentity number captured from the Identity document.
date_of_birthMDate of birth captured from the Identity document.
genderMGender from the Identity document. (Possible values: FEMALE, MALE)
line1MFirst line of the address.
cityMCity of the address.
zipMZip code of the address.
state_isoMState/region of the country in ISO2 format. For the available states, please refer to the state/region list. (Example: MY-01)
country_iso2MCountry code in ISO2 format. For the available countries, please refer to the country list. (Example: my, id)
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)

6. Upload Credit card

To upload an credit card, just provide a properly configured UploadCcParam object as an argument to the uploadCc() method. Here's how:

const param = {
	front_doc_base64: YOUR_FRONT_DOC;
	back_doc_base64: YOUR_BACK_DOC;
}
const result = await pwInstance.uploadCc(param);
UploadCcParam
ParameterM/O/CDescription
front_doc_uriCURI of the cropped front eKYC image, without the background. Required when front_doc_base64 is absent.
front_doc_uri_fullOURI of the full front eKYC image, including background.
back_doc_uriCURI of the cropped back eKYC image, without the background. Required when back_doc_base64 is absent.
back_doc_uri_fullOURI of the full back eKYC image, including background.
front_doc_base64CCropped front eKYC image in base64 format, without the background. Required when front_doc_uri is absent.
front_doc_base64_fullOFull front eKYC image in base64 format, including background.
back_doc_base64CCropped Back eKYC image in base64 format, without the background. Required when back_doc_uri is absent.
back_doc_base64_fullOFull Back eKYC image in base64 format, including background.
Output
PropertyDescription
front_document_idUnique ID of the front document.
back_document_idUnique ID of the back document.
is_retriableIndicates if the upload process can be retried.
is_partially_maskedIndicates if the sensitive info in credit card has been masked. (Example: middle 6 digit number)
missing_fieldsList of the missing fields on credit card. (Possible values: cc_number_first_6, cc_number_last_4, full_name, date_of_expiry)
masked_coordinatesCoordinates of the masked regions on the document.

7. Retrieve Credit Card Verification Results

After completing the upload credit card verification process, retrieve the credit card verification results using the viewCcResult() method. No arguments are required for this method:

const result = await pwInstance.viewCcResult();
Output
PropertyDescription
statusStatus of credit card verification documents. (Possible values: pending, approved, rejected, review)
is_retriableIndicates if the verification process can be retried.
is_expiredIndicates if the card has expired.
result(Refer to CcResults).
CcResults
PropertyDescription
full_nameFull name captured from the credit card.
cc_number_first_6First 6 digits captured from the credit card.
cc_number_last_4Last 4 digits captured from the credit card.
doe_yearDate of expiry year captured from the credit card.
doe_monthDate of expiry month captured from the credit card.

8. Update Credit Card Verification Result

After retrieving the credit card verification results, you can update them using the updateCcForm() method. Pass a properly configured UpdateCcFormParam object to update the results:

const param = {
	full_name: YOUR_FULL_NAME,
	cc_number_first_6: YOUR_CC_FIRST_6_NO,
	cc_number_last_4: YOUR_CC_LAST_4_NO,
	doe_year: YOUR_CC_EXPIRY_YEAR,
	doe_month: YOUR_CC_EXPIRY_MONTH,
 };
const result = await pwInstance.updateCcForm(param);
UpdateCcFormParam
ParameterM/O/CDescription
full_nameMFull name captured from the credit card.
cc_number_first_6MFirst 6 card number captured from the credit card.
cc_number_last_4MLast 4 card number captured from the credit card.
doe_yearMDate of expiry year captured from the credit card.
doe_monthMDate of expiry month captured from the credit card.
Output
PropertyDescription
resultStatus of update verification result. (Possible values: true, false)

9. Upload Proof Of Address

To upload proof of address, just provide a properly configured UploadPoaParam object as an argument to the uploadPoa() method. Here's how:

const param = { poa_base64: YOUR_DOC }
const result = await pwInstance.uploadCc(param);
UploadPoaParam
ParameterM/O/CDescription
poa_uriCURI of the proof of address document file. Accepted Formats: PNG, JPG, JPEG, or PDF. Size Limit: Maximum file size 2MB. Required when poa_base64 is absent.
poa_base64CProof of address document file in base64 format. Accepted Formats: PNG, JPG, JPEG, or PDF. Size Limit: Maximum file size is 2MB. Required when poa_uri is absent.
Output
PropertyDescription
document_idUnique ID of the document.
is_retriableIndicates if the upload process can be retried.

10. Retrieve Proof Of Address Verification Results

After completing the upload proof of address verification process, retrieve the proof of address verification results using the viewPoaResult() method. No arguments are required for this method:

const result = await pwInstance.viewPoaResult();
Output
PropertyDescription
statusStatus of proof of address verification documents. (Possible values: pending, approved, rejected, review)
is_retriableIndicates if the verification process can be retried.
result(Refer to PoaResults).
PoaResults
PropertyDescription
receiver_nameReceiver's full name captured from the document.
receiver_addressReceiver's first line address.
receiver_cityCity of the receiver's address.
receiver_zipZip code of the receiver's address.
receiver_state_isoState/region of the country in ISO2 format. For the available states, please refer to the state/region list. (Example: MY-01)
receiver_country_iso2Country code in ISO2 format. For the available countries, please refer to the country list. (Example: my, id)

11. Update Proof Of Address Result

After retrieving the proof of address results, you can update them using the updatePoaForm() method. Pass a properly configured UpdatePoaFormParam object to update the results:

const param = {
	receiver_name: RECEIVER_NAME,
	receiver_address: RECEIVER_ADDRESS,
	receiver_city: RECEIVER_CITY,
	...
};
const result = await pwInstance.updatePoaForm(param);
UpdatePoaFormParam
ParameterM/O/CDescription
receiver_nameMReceiver's full name captured from the document.
receiver_addressMReceiver's first line address captured from the document.
receiver_cityMCity of the receiver's address captured from the document.
receiver_zipMZip code of the receiver's address captured from the document.
receiver_state_isoMState/region of the country in ISO2 format. For the available states, please refer to the state/region list. (Example: MY-01)
receiver_country_iso2MCountry code in ISO2 format. For the available countries, please refer to the country list. (Example: my, id)
Output
PropertyDescription
resultStatus of update verification result. (Possible values: true, false)

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.

2.0.0-2

8 months ago

2.0.0

4 months ago

2.0.0-1

10 months ago

2.0.0-0

11 months ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

2 years ago

0.0.1-beta.7

2 years ago

0.0.1-beta.6

2 years ago

0.0.1-beta.5

2 years ago

0.0.1-beta.4

2 years ago

0.0.1-beta.3

2 years ago

0.0.1-beta.2

2 years ago

0.0.1-beta.1

2 years ago

0.0.1-beta.0

2 years ago