Plugin Response
Response States
SUCCESS: Process finished successfully
EXIT: Process terminated by the user with no errors
FAILURE: Process finished with the user's failure to pass the service requirements
ERROR : Process terminated due to an error in the builder
Document verification plus - Case Handling
When using VIDVOCRResult.getData(), the returned ocrResult may include a documentVerificationPlus object.
This object contains validation flags and quality signals that help you determine whether the document should be accepted, reviewed, recaptured, or rejected.
Fields Returned Under documentVerificationPlus
documentVerificationPlusfrontDataValidity
boolean
Overall validity of the front side based on greyscale flags + invalid fields list
backDataValidity
boolean
Overall validity of the back side based on greyscale flags + invalid fields list
isFrontGreyscale
boolean
Indicates whether the front side is greyscale
isBackGreyscale
boolean
Indicates whether the back side is greyscale
expired
boolean
Whether the document is recognized as expired
reviewRequired
List<String>
Fields that require attention (e.g. Nid, gender, expirydate…)
How to Read These Values
frontDataValidityandbackDataValidityact as parent flags → You can take action directly based on them if you want a simple validation flow.For more control, you can check detailed signals:
use greyscale flags if you want to reject black-and-white copies
use
reviewRequiredto apply different logic per field e.g. reject if nid is invalid but allow if gender is inconsistent
This allows fully customizable decision logic depending on your business rules.
Example Handling Logic
/// Note:
/// - All actions here are only example handlers.
/// - Functions like showRetryDialog(), requestRecapture(), showError(), startOCR()
/// are placeholder functions you must implement based on your UI flow.
final flags = result.data?nameValuePairs.ocrResult?.ocrResult?.documentVerificationPlus;
if (flags != null) {
// --------------------- GENERIC VALIDATION RESULTS --------------------- //
// Global document validity
if (flags.frontDataValidity == false || flags.backDataValidity == false) {
showRetryDialog(
title: "Document failed validation checks.",
message: "Please try again.",
onConfirm: () => startOCR(), // Restart logic - implement
);
}
// Greyscale detection
else if (flags.isFrontGreyscale == true || flags.isBackGreyscale == true) {
requestRecapture("Document appears to be black & white.");
// Custom function for recapture action
}
// Expired document
else if (flags.isExpired == true) {
showRetryDialog(
title: "OCR",
message: "Expired ID, Please try again with your recent National ID.",
onConfirm: () => startOCR(),
);
}
// One or more fields need review
else if (flags.reviewRequired?.isNotEmpty == true) {
showError("Some fields require manual review.");
}
// --------------------- FIELD-LEVEL VALIDATION CASES --------------------- //
final review = flags.reviewRequired ?? [];
if (review.contains("serial_number")) {
showRetryDialog(
title: "OCR",
message: "Serial number is incorrect. Please try again.",
onConfirm: () => startOCR(),
);
}
if (review.contains("back_nid") || review.contains("front_nid")) {
requestRecapture("NID Mismatch");
}
if (review.contains("date_of_birth")) showError("Date of birth could not be verified.");
if (review.contains("street")) showError("Street address is empty.");
if (review.contains("police_station")) showError("Police station field needs review.");
if (review.contains("governorate")) showError("Governorate value could not be verified.");
if (review.contains("birth_governorate")) showError("Birth governorate requires review.");
if (review.contains("expiry_date")) showError("Expiry date is missing or invalid.");
if (review.contains("release_date")) showError("Release date did not pass validation.");
else {
// DEFAULT — document accepted successfully
}
}
Advance confidence - Case Handling
When using VIDVOCRResult.getData(), the returned ocrResult may include a advancedConfidence object.
This object contains manipulation flags that help you determine whether the document should be accepted, reviewed, recaptured, or rejected.
Fields Returned Under advanceConfidence
advanceConfidencefraudDetectionZone
int
Parent zone flag → Result of face + image manipulation combined
faceFraudZone
int
Fraud confidence specifically related to face physical tampering
frontImageManipulationZone
int
Indicates signs of front image physical manpulation
Zone Meaning
0
Green
No manipulation detected
1
Yellow
Requires human review (suspicious)
2
Red
Strong indicators of fraud / manipulation
Example Handling Logic
//Note that all decisions taken in this code are just an example of how you can handle
//the logic and that you can take the preferred action according to your business needs
final fraud = result.data?.ocrResult?.advancedConfidence;
// Parent Zone
if (fraud?.fraudDetectionZone == 1) showWarning("Review required"); // Replace with custom handling
if (fraud?.fraudDetectionZone == 2) requestRecapture("Fraud suspected"); // Developer replaces with custom retry logic
// Detailed Checks
if (fraud?.faceFraudZone == 1 || fraud?.faceFraudZone == 2) {
showError("Face manipulation detected"); // Replace with custom handling
}
if (fraud?.frontImageManipulationZone == 1 || fraud?.frontImageManipulationZone == 2) {
showError("ID surface manipulation detected"); // Replace with custom handling
}Primary Response Object
nameValuePairs
nameValuePairs Object Body
nameValuePairs Object Bodystate<string>errorCode<string>errorMessage<string>ocrResult<object>capturedImageslist<object>eventslist<object>errorslist<object>
ocrResult Object Body
ocrResult Object BodysessionID<string>
Review Required Feature Breakdown:
The following are possible values that could come in the review required list along with their triggers
capturedImages Object Body
capturedImages Object BodynationalIDLabel<string>nationalIdImage<base64-string>
events Object Body
events Object Bodydate<string>key<string>screen<string>timestamp<string>type<string>
errors Object Body
errors Object Bodycode<string>message<base64-string>date<string>screen<string>timestamp<string>type<string>
State Responses
SUCCESS
nameValuePairs<object>state<string>ocrResult<sub-object>capturedImages<sub-object>events<sub-object>errors<sub-object>
EXIT
nameValuePairs<object>state<string>ocrResult<sub-object>capturedImages<sub-object>step<string>events<sub-object>errors<sub-object>
FAILURE
nameValuePairs<object>state<string>errorCode<int>errorMessage<string>capturedImages<sub-object>ocrResult<sub-object>events<sub-object>errors<sub-object>
ERROR
nameValuePairs<object>state<string>errorCode<int>errorMessage<string>
Last updated