Events and Callbacks
The start()
method in the ShuftiPro Web SDK initiates the verification process and provides a mechanism to capture the response through a callback function. This response object contains valuable information about the verification flow, allowing you to handle different verification stages.
There are two ways to listen to response:


Using a Callback Function



shuftiPro.start((response) => {
console.log('Verification response:', response);
// Update your application UI based on the response event (e.g., display success/failure message)
});
Using Event Listeners



shuftiPro.on('shuftiResponse', (response) => {
console.log('Verification response:', response);
});
Response
In case of WebSDK initialization with a journey_id, a callback function can be passed to the start() method. This will return a response containing information about the verification process.
The response includes the following key properties:
Parameters | Description |
---|---|
status_code | Type: int Shufti Pro Verification API uses conventional HTTP response codes to indicate the success or failure of an API request. Details can be found here. |
event | Type: String Events are sent in responses that show the status of the request. These events are sent in callbacks for both onsite and offsite verifications. |
body | Type: Object Contains additional details related to the verification request. |
verification_url | Type: String URL for the verification flow if applicable (e.g., for redirecting the user) |
Example Response Object
response-object
{
"body": {
"reference": "sp-bc-prod-xyz",
"event": "request.pending",
"verification_url": "https://app.shuftipro.com/verification/process/",
"email": null,
"country": null
},
"event": "request.pending",
"status_code": 200,
}
Response Events
Some of response events are following:
Event | Description |
---|---|
request.pending | This event is returned for all on-site verifications until the verification is completed or timeout. |
verification.accepted | Verification accepted callback. |
verification.declined | Verification declined callback. |
verification.cancelled | This callback is returned when verification is cancelled midway by the end user. |
request.received | This event states that the verification request has been received and is under processing. |