Skip to main content

Response Events

Below is the list of possible events fired from OCR Activity during the flow.

Event IdentifierPayloadDescriptionBehavior after post
LAUNCH_FAILUREnoneFired in case of launch failure due to insufficient or faulty parameters provided.Activity will exit.
FRONT_SUCCESS"frontImage": StringFired after successfully capturing valid front CNIC image. Local url of stored image (of provided size) will be sent.Flow will continue for back card.
FRONT_FAILUREnonePosted when unable to capture picture of front card due to device inability.Activity will exit.
BACK_SUCCESS"backImage": StringSimilar to FRONT_SUCCESS for back image.Loading interface will be shown as CNIC extraction is proceeded.
BACK_FAILUREnoneDevice error to capture image.Activity will exit.
OCR_SUCCESSListed BelowSuccessful extraction of identity number from captured images after complete flow.Activity will exit.
OCR_FAILUREnoneUnsuccessful recognition identity number.User will be prompted to re-scan (back card only).

Payload provide along with OCR_SUCCESS event

KeyTypeDescription
identityNumberStringExtracted identity number
frontImageStringLocal Url of captured front image (same as sent on FRONT_SUCCESS)
backImageStringLocal Url of captured back image (same as sent on BACK_SUCCESS)
documentType"new" | "old"Detected type of CNIC.
distanceFloatDistance between provided and extracted number. (between 1 and 0)