Callback Methods
The Predictive Document Verification (DocV) Web SDK provides a set of callback methods that let you monitor and respond to key events in the document capture and upload flow. These callbacks are configured through the config object passed to the SocureDocVSDK.launch() method and can be used to implement custom logic based on user progress, success, or error conditions.
The config object also supports behavioral flags to customize the handoff experience—for example, enabling a QR code, skipping SMS input, auto-closing the Capture App tab, or streamlining mobile flow by skipping the Continue on New Tab screen.
var config = {
onProgress: function(event) { /* Called during capture */ },
onSuccess: function(response) { /* Called on success */ },
onError: function(error) { /* Called on error */ },
qrCodeNeeded: true, // Show QR code option
disableSmsInput: false, // Enable SMS input
closeCaptureWindowOnComplete: true, // Auto-close tab after document upload confirmation
autoOpenTabOnMobile: true // Skip "Continue on New Tab" screen on mobile and launch Capture App in a new tab
};config object parameters
config object parametersNote:
The callback functions are required. If you are not using them, the contents within the brackets may be left empty, but the functions themselves must still be defined.
| Parameter | Type | Required | Description |
|---|---|---|---|
onProgress | Function | Yes | Callback function triggered during the document capture process. |
onSuccess | Function | Yes | Callback function executed when the document capture process completes successfully. |
onError | Function | Yes | Callback function triggered when an error occurs during the document capture process. |
qrCodeNeeded | Boolean | No | Determines whether a QR code is displayed on the handoff component. If true, the system generates a QR code. |
disableSmsInput | Boolean | No | Disables the SMS entry option on the handoff component, showing only the QR code option. <br> Note: Setting this to true overrides qrCodeNeeded: false. |
closeCaptureWindowOnComplete | Boolean | No | Automatically closes the Capture App browser tab 2 seconds after the consumer reaches the Confirmation screen. <br><br> Note: If a redirect.url is configured in the Evaluation API call or in the RiskOS™ Dashboard, that redirect will take precedence. |
autoOpenTabOnMobile | Boolean | No | Automatically opens the Capture App in a new browser tab on mobile devices, bypassing the intermediate Continue on New Tab screen |
Callback event types
| Event Type | Status | Callback | Description |
|---|---|---|---|
WAITING_FOR_REDIRECT_METHOD | Awaiting Consumer Action | onProgress | The consumer is directed to the Web SDK handoff screen, which provides the option to send an SMS or scan a QR code. |
WAITING_FOR_USER_TO_REDIRECT | SMS Sent – Awaiting Consumer | onProgress | The Web SDK has sent an SMS containing the document request URL and is awaiting the consumer to open the link. |
WAITING_FOR_UPLOAD | Capture App Opened | onProgress | The consumer has been redirected to the Capture App and is ready to begin the flow. |
DOCUMENTS_UPLOADED | Image Upload Complete | onSuccess | The consumer has successfully completed the Capture App flow, and all images have been uploaded. |
CONSENT_DECLINED | Consent Declined | onError | The consumer declined the Privacy Statement and Consent agreement, terminating the session. |
DOCUMENTS_UPLOAD_FAILED | Documents Upload Failed | onError | An error occurred while uploading one or more document images or the selfie, preventing completion. |
Callback Details
The onProgress callback returns real-time updates as the consumer progresses through the document capture and upload process.
onProgress
onProgress{
"docvTransactionToken": "6d454cdd-108f-46f5-8fc2-b92529940eed",
"status": "WAITING_FOR_REDIRECT_METHOD",
"key": "6d454cdd-108f-46f5-8fc2-b92529940eed",
"customerUserId": "121212",
"mobileNumber": "+13475550100",
"deviceSessionToken": "..."
}onSuccess
onSuccessThe onSuccess callback is triggered when the document and selfie images are successfully uploaded.
{
"docvTransactionToken": "6d454cdd-108f-46f5-8fc2-b92529940eed",
"status": "DOCUMENTS_UPLOADED",
"key": "6d454cdd-108f-46f5-8fc2-b92529940eed",
"customerUserId": "121212",
"mobileNumber": "+13475550100",
"deviceSessionToken": "..."
}onError
onErrorThe onError callback is triggered when an issue occurs during the document capture or upload process.
{
"docvTransactionToken": "c1c4223f-ce22-4c72-9fdf-90480ccefc77",
"status": "CONSENT_DECLINED",
"key": "c1c4223f-ce22-4c72-9fdf-90480ccefc77",
"customerUserId": "121212",
"mobileNumber": "+13475550100",
"deviceSessionToken": "..."
}Updated 3 months ago
