Integrating Persona

How do I drive KYC Manually?

Learn how you can drive the Persona KYC flow manually instead of using the wrapped Cybrid SDK flow

Here is an overview of how to integrate the Persona SDK embedded flow, instead of using the Cybrid SDK:

Create an identity verification for a customer:

POST /api/identity_verifications

Request:

{
 "type": "kyc",
 "method": "id_and_selfie",
 "customer_guid": { customer_guid },
 "country_code": { country_code }
}

Response:

{
 "type": "kyc",
 "guid": { identity_verification_guid },
 "customer_guid": { customer_guid },
 "created_at": "2023-10-03T14:32:52.317Z",
 "method": "id_and_selfie",
 "state": "storing",
 "outcome": null,
 "failure_codes": [],
 "country_code": { country_code }
}

Get an identity verification for a customer:

GET /api/identity_verifications/{ identity_verifcation_guid }

  • Generating an inquiry is async, so you will have to poll
  • The persona_inquiry_id may be null

Response:

{
 "type": "kyc",
 "guid": { identity_verification_guid },
 "customer_guid": { customer_guid },
 "created_at": "2023-10-03T14:32:52.317Z",
 "method": "id_and_selfie",
 "state": "waiting",
 "outcome": null,
 "failure_codes": [],
 "country_code": "US",
 "persona_inquiry_id": { persona_inquiry_id },
 "persona_state": "waiting"
}

Instantiate the Persona embedded client:

Example:

<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8" />
  <title>Client</title>

  <!-- Add this script tag to import Persona JavaScript library -->
  <script src="https://cdn.withpersona.com/dist/persona-v4.9.0.js"></script>
 </head>

 <body></body>
 <script>
  let client = new Persona.Client({
   inquiryId: { persona_inquiry_id },
   language: { language },
   onReady: () => client.open(),
   onEvent: (eventName, metaData) => {
    console.log(`Event: ${eventName}`);
   },
   onComplete: ({ inquiryId, status, fields }) => {
    console.log(`Submitted: ${inquiryId}`);
   },
   onCancel: (inquiryId, sessionToken) =>
    console.log(`Cancelled inquiry: ${inquiryId}`),
   onError: (status, code) => {
    console.log(`Error: ${status}`);
   }
  });
 </script>
</html>