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

📘

Note:

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.

ParameterTypeRequiredDescription
onProgressFunctionYesCallback function triggered during the document capture process.
onSuccessFunctionYesCallback function executed when the document capture process completes successfully.
onErrorFunctionYesCallback function triggered when an error occurs during the document capture process.
qrCodeNeededBooleanNoDetermines whether a QR code is displayed on the handoff component. If true, the system generates a QR code.
disableSmsInputBooleanNoDisables the SMS entry option on the handoff component, showing only the QR code option. <br> Note: Setting this to true overrides qrCodeNeeded: false.
closeCaptureWindowOnCompleteBooleanNoAutomatically 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.
autoOpenTabOnMobileBooleanNoAutomatically opens the Capture App in a new browser tab on mobile devices, bypassing the intermediate Continue on New Tab screen

Callback event types

Event TypeStatusCallbackDescription
WAITING_FOR_REDIRECT_METHODAwaiting Consumer ActiononProgressThe 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_REDIRECTSMS Sent – Awaiting ConsumeronProgressThe Web SDK has sent an SMS containing the document request URL and is awaiting the consumer to open the link.
WAITING_FOR_UPLOADCapture App OpenedonProgressThe consumer has been redirected to the Capture App and is ready to begin the flow.
DOCUMENTS_UPLOADEDImage Upload CompleteonSuccessThe consumer has successfully completed the Capture App flow, and all images have been uploaded.
CONSENT_DECLINEDConsent DeclinedonErrorThe consumer declined the Privacy Statement and Consent agreement, terminating the session.
DOCUMENTS_UPLOAD_FAILEDDocuments Upload FailedonErrorAn 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

{
  "docvTransactionToken": "6d454cdd-108f-46f5-8fc2-b92529940eed",
  "status": "WAITING_FOR_REDIRECT_METHOD",
  "key": "6d454cdd-108f-46f5-8fc2-b92529940eed",
  "customerUserId": "121212",
  "mobileNumber": "+13475550100",
  "deviceSessionToken": "..."
}

onSuccess

The 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

The 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": "..."
}