Plugin Response

Plugin response example

The method returns a JSON string containing the response state and result data. Parse the response to handle different outcomes:

final resultJson = await VIDVDocKit().start(args);
 
if (resultJson != null) {
 final response = json.decode(resultJson);
 final state = response['state'];
 
 switch (state) {
  case 'SUCCESS':
  // Handle successful capture
  break;
  case 'EXIT':
  // Handle user cancellation
  break;
  case 'ERROR':
  // Handle configuration error
  break;
  case 'FAILURE':
  // Handle service failure
  break;
 }
}

🔁 VIDVDocKitResponse Types

Type

Description

Code example

Success(data)

When the document is successfully captured and processed, the response contains the extracted data and captured images.

{

"state": "SUCCESS",

"result": {

"data": {

"captures": {

"front": "base64_encoded_

image...",

"back": "base64_encoded_

image..."},

"extractedData": {

"first_name": "John",

"last_name": "Doe",

"birth_date": "1990-01-01",

"national_id": "123456234",

"gender": "M",

"address": "123 X Street"}

},

"sessionID": "abc123-def456",

"hmacData": "..."}}

Error(code, message)

Returned when there is a configuration or builder error. This typically indicates an issue with the provided parameters.

{

"state": "ERROR",

"code": "INVALID_CONFIG",

"message": "Missing required parameter: access_token"}

ServiceFailure(code, message, data)

Returned when a service or network failure occurs during processing.

{

"state": "FAILURE",

"code": "SERVICE_ERROR",

"message": "Unable to connect to the server",

"result": {

"data": {

"captures": { ... }

}}}

Exit(step, data)

Returned when the user cancels the capture flow. May contain partial data if the user exited after some captures

{

"state": "EXIT",

"step": "capture_front",

"result": {

"data": {

"captures": { ... },

"extractedData": null}

}}

📦 VIDVDocKitData

Field

Type

Description

sessionID

String

Unique session ID

hmacData

String

HMAC signature for data verification (if enabled)

captures

Map<String,String?>

Document images in Base64

extractedData

Map<String,String?>

Extracted values from document

🖼 Captures

chevron-rightEgyptian National IDhashtag

Field

Type

Description

egy_front_nid

String

Base64 front image

egy_back_nid

String

Base64 back image

chevron-rightMRZ Passporthashtag

Field

Type

Description

egy_passport

String

Base64 front image

chevron-rightTunisian National IDhashtag

Field

Type

Description

tunisian_front_nid

String

Base64 front image

tunisian_back_nid

String

Base64 back image

chevron-rightAlgerian National IDhashtag

Field

Type

Description

algerian_front_nid

String

Base64 front image

algerian_back_nid

String

Base64 back image

🧾ExtractedData

chevron-rightextractedDataMap<String,String?> (Egyptian National ID)hashtag
  • nid <string>

  • first_name <string>

  • full_name <string>

  • street <string>

  • front_nid <string>

  • serial_number <string>

  • back_nid <string>

  • release_date <string>

  • gender <string>

  • marital_status <string>

  • profession<string>

  • religion <string>

  • husband_name <string>

  • date_of_birth <string>

  • age <string>

  • birth_governorate <string>

  • gender <string>

  • police_station <string>

  • governorate<string>

  • expiry_date <string>

chevron-rightextractedData Map<String,String?> (MRZ Passport)hashtag
  • name <string>

  • surname <string>

  • date_of_birth <string>

  • nationality <string>

  • passport_number <string>

  • sex <string>

  • expiration_date <string>

chevron-rightextractedData Map<String,String?> (Tunisian National ID)hashtag
  • nid <string>

  • first_name <string>

  • last_name <string>

  • father_name <string>

  • husband_name <string>

  • birthdate <string>

  • birthplace <string>

  • mother_name <string>

  • profession <string>

  • address <string>

  • issue_date<string>

  • thumbprint_code <string>

chevron-rightextractedData Map<String,String?> (Algerian National ID)hashtag
  • nid <string>

  • first_name <string>

  • surname <string>

  • date_of_birth <string>

  • place_of_birth <string>

  • blood_type <string>

  • gender<string>

  • issuance_date<string>

  • serial_no<string>

  • issuing_authority<string>

  • expiration_date <string>

Last updated