Customer Verification
Introduction
The customer verification module contains features that allow you to start verification sessions for your customers in order to complete the KYC (Know Your Customer) process, get their verification status and check the status of a session.
Customer Verification Service
The CustomerVerificationService
can be used for managing customer verification related operations.
Start Kyc Session
Starts a KYC session. In order to issue the request, you need to supply a merchant reference number, optionally you can also supply a returnUrl
and a language
. If the returnUrl
is supplied, the customer will be redirected to that URL after the verification process is completed. If the language is supplied, the verification process will be displayed in that language. If the language is not supplied, the verification process will be displayed in the language that the customer has selected in their profile.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const request: KycSessionRequest = {
merchantRefNum: '8422d64e-4f16-4c41-a36f-f1f11c425f2e',
returnUrl: '<your return url>',
language: 'en'
};
Wallet.getInstance().getCustomerVerificationService().startKycSession(request)
.then((kycSession) => console.log('KYC Session', kycSession))
.catch((error) => console.error(error));
Get Kyc Session
Retrieves a session by session ID.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const sessionId = '55bf0c21-7c22-4412-9d6f-40b745838499';
Wallet.getInstance().getCustomerVerificationService().getKycSession(merchantRefNum)
.then((kycSession) => console.log('KYC Session', kycSession))
.catch((error) => console.error(error));
Get Kyc Status
Retrieves the Verification status of the customer.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
Wallet.getInstance().getCustomerVerificationService().getKycStatus()
.then((kycStatus) => console.log('KYC Status', kycStatus))
.catch((error) => console.error(error));
Customer Verification Session
After starting the KYC session, the response object will contain a redirectUrl
. You need to redirect the customer to that URL in order to display the Paysafe KYC Frontend application and begin the verification process. For a more seemless experience, you can use the redirectUrl
to open the KYC Frontend in an iframe.
After the verification process is completed, the customer will be redirected to the returnUrl
that you have supplied in the request or have set up during your onboarding process.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const request: KycSessionRequest = {
merchantRefNum: 'cc4426ae-7b5a-4122-97a0-699941368e5a',
returnUrl: 'http://<your site>.com/return',
language: 'en'
};
const iframe = document.getElementById('kyc-iframe');
Wallet.getInstance().getCustomerVerificationService().startKycSession(request)
.then((kycSession) => {
iframe.src = kycSession.redirectUrl;
localStorage.setItem('kycSessionId', kycSession.id);
})
.catch((error) => console.error(error));
Handling KYC Frontend Redirect
In your return url you may want to check the status of the session and update your UI accordingly.
import { Wallet } from '@paysafe/paysafe-wallet-saas-web/wallet';
const kycSessionId = localStorage.getItem('kycSessionId');
Wallet.getInstance().getCustomerVerificationService().getKycSession(kycSessionId)
.then((kycSession) => {
if (kycSession.status === KycSessionStatus.COMPLETE) {
// Customer has sucsessfully completed the verification process
// This does not mean that the customer has been verified. You need to check the status of the customer
}
if (kycSession.status === KycSessionStatus.EXPIRED) {
// customer's session has expired. You may want to start a new session
}
});