# Results

This page catalogs the data returned by the plugin's APIs and modules, plus the typed error strings you may receive.

## How results and errors are delivered

Every plugin call takes a success callback and an error callback:

```js
cordova.exec(successCallback, errorCallback, "Cplugin", "methodName", [args]);
```

The success callback receives either a session-level result object or an aggregated result object containing per-module result payloads keyed by name. The error callback receives a typed error string.

The two sections below document both:

- [API results](#api-results): the shape of the success callback payload for each API method, and the error strings its error callback may deliver.
- [Module result objects](#module-result-objects): the shape of the per-module payload that each module contributes to the aggregated result of `startOnboarding()` and `startOnboardingSection()`.

## User cancellation

User cancellation is not a successful completion. When the user cancels a section or flow, the error callback fires with a platform-specific string: "onUserCancelled" on Android and "userCancelled" on iOS. Handle these in your error callback alongside other typed errors.

## API results

### faceMatch()

Success callback receives the face match result. See [faceMatchData](#facematchdata) for the shape.

### finishOnboarding()

Success callback indicates the session was finalized successfully. No structured payload is delivered.

### getUserScore()

Success callback receives the full score JSON object with identity verification scores. This is passed through directly from the Incode API. Pass `"fast"` or `"accurate"` as the mode:

```js
cordova.exec(
  function (winParam) {
    console.log("Score:", JSON.stringify(winParam));
  },
  function (err) { console.log("Error:", err); },
  "Cplugin",
  "getUserScore",
  ["fast"]
);

// Result shape
{
  userScoreData: {
    data: {
      overallScore: "",
      status: "",              // stringified SDK enum (ok, warn, unknown, fail, manual)
      facialRecognitionScore: "",
      existingUser: "",
      idVerificationScore: "",
      livenessOverallScore: ""
    },
    extendedUserScoreJsonData: "{...}"  // optional raw JSON string from API
  }
}
```

### initializeSDK()

Success callback indicates the SDK was initialized successfully. No structured payload is delivered.

Error callback receives one of the following typed strings:

| Error               | Meaning                                             |
| ------------------- | --------------------------------------------------- |
| `simulatorDetected` | Running on a simulator while `testMode` is `false`. |
| `testModeEnabled`   | `testMode` is `true` in a production context.       |
| `invalidInitParams` | Bad `apiKey` or `apiUrl`.                           |
| `configError`       | Configuration error.                                |
| `sslPinningFailed`  | SSL pinning failure (MITM or bad certificate).      |
| `unknown`           | Unexpected error.                                   |

### isInitialized()

Success callback receives a boolean: `true` if the native SDK is fully initialized, `false` otherwise.

```js
cordova.exec(
  function (isInitialized) { console.log("Initialized:", isInitialized); },
  function (err) { console.log("Error:", err); },
  "Cplugin",
  "isInitialized",
  []
);
```

### setupOnboardingSession()

Success callback receives an object containing the created session identifiers:

```js
{
  interviewId: "string", // the session id
  token: "string"        // the session token
}
```

### startFaceLogin()

Success callback receives a face login result object:

```js
{
  faceMatched: true,           // boolean
  spoofAttempt: false,         // boolean
  image: {
    pngBase64: "",             // base64-encoded selfie
    encryptedBase64: ""        // E2EE-encrypted selfie (when E2EE is enabled)
  },
  customerUUID: "",            // string or null; null when faceMatched is false
  interviewId: "",             // string; session ID in which the user was approved
  interviewToken: "",          // string; session token in which the user was approved
  token: "",                   // string; token for further API calls
  transactionId: "",           // string; unique ID of this face login attempt
  hasFaceMask: false           // boolean; true when login failed because user wore a mask
}
```

Error callback receives a typed string passed through from the underlying native SDK. The error string set differs between Android and iOS. See the Android and iOS SDK documentation for the error strings each platform may emit.

Common examples include `faceLoginFailed` and `noUserFound`.

### startOnboarding()

Success callback receives the aggregated result of the executed flow: a top-level object with a `status` field plus one key per module that ran. Each module contributes its own key (for example, `frontIdData`, `selfieData`, `faceMatchData`) with its own payload. See [Module result objects](#module-result-objects) below for each module's shape.

### startOnboardingSection()

Success callback receives a top-level object:

```js
{         
  sectionTag: "your-tag",       // the value of the sectionTag parameter you passed
  // ...plus one key per module that ran (see Module result objects below)
}
```

Each module that ran in the section contributes its own key (for example, `frontIdData`, `selfieData`, `faceMatchData`) to this object.

Error callback receives one of the following typed strings:

| Error                 | Meaning                                   |
| --------------------- | ----------------------------------------- |
| `simulatorDetected`   | Running on a simulator.                   |
| `rootDetected`        | Rooted device detected.                   |
| `hookDetected`        | Hooking framework detected.               |
| `permissionsDenied`   | Required permissions denied.              |
| `virtualEnvDetected`  | Virtual or emulated environment detected. |
| `locationUnavailable` | Unable to determine location              |
| `unknown`             | Unexpected error.                         |

See [Known Issues](known-issues) for notes on how device-environment detection (root, hook, virtual environment) behaves on Android.

## Module result objects

Each module contributes a key to the `startOnboarding()` or `startOnboardingSection()` success callback payload. This section catalogs the shape of each key's value, alphabetized by key name.

### antifraudData

From `addAntifraud`.

```js
{ status: true } // boolean: true = antifraud check passed
```

### approveData

From the non-UI `approve` module.

```js
{
  status: "approved",       // "approved" | "declined" | "error"
  id: "<uuid>",             // session UUID
  customerToken: "<token>"  // customer token
}
```

### backIdData

From `addId`.

```js
{
  status: "ok",              // see status values below
  image: "<base64String>",   // base64-encoded image
  classifiedIdType: "ID",    // classified document type, e.g. "ID"
  idCategory: "primary",     // "primary" | "secondary"
  chosenIdType: "id",        // "id" | "passport"
  allAttemptsExhausted: false // true when no more retries available
}
```

`status` values:

| Value                 | Meaning                         |
| --------------------- | ------------------------------- |
| `ok`                  | Capture succeeded               |
| `unknown`             | Unknown error                   |
| `errorClassification` | Document classification failed  |
| `errorGlare`          | Glare detected                  |
| `errorSharpness`      | Image not sharp enough          |
| `errorReadability`    | Document not readable           |
| `errorInCapture`      | Capture error (iOS)             |
| `errorUnacceptableID` | ID not acceptable (iOS)         |
| `wrongSide`           | Wrong document side shown (iOS) |

### curpData

From `CURPValidation`.

```js
{
  status: "success",  // "success" | success message string
  curp: "string",     // validated CURP code
  data: any           // raw CURP data from the validation service
}

{
  status: "fail",  // "fail" | error message string
}
```

### documentData

From `addDocumentScan`. The data field's structure depends on the document type captured.

```js
{
  type: "addressStatement", // "addressStatement" | "medicalDoc" | "paymentProof" | "otherDocument1" | "otherDocument2" | "otherDocument3"
  image: "<base64String>",
  address: {
    city: "string",
    colony: "string",
    postalCode: "string",
    street: "string",
    state: "string"
  },
  data: "<rawData>"
}
```

### eKYC

From `addEKYC`. Note that the result key is `eKYC`, not `eKYCData`.

```js
{ status: true } // boolean: true = eKYC checks passed
```

### emailData

From `addEmail`.

```js
{
  email: "user@example.com",
  status: "success" // "success" | "fail"
}
```

### faceAuthenticationData

From `addFaceAuthentication`.

```js
{
  status: "success",              // "success" | "fail"
  customerUUID: "string",         // UUID of the authenticated customer
  selfieBase64: "string",         // base64-encoded selfie image
  selfieEncryptedBase64: "string", // E2EE-encrypted selfie (when E2EE is enabled)
  error: null                     // null on success; typed string on failure (see below)
}
```

`error` values when `status` is `"fail"`:

| Error                   | Meaning                                  |
| ----------------------- | ---------------------------------------- |
| `inactiveSession`       | Session is no longer active              |
| `nonexistentCustomer`   | No enrolled face found for this user     |
| `lensesDetected`        | Glasses or lenses detected               |
| `faceMaskDetected`      | Face mask detected                       |
| `headCoverDetected`     | Head covering detected                   |
| `closedEyesDetected`    | Eyes are closed                          |
| `faceTooDark`           | Insufficient lighting                    |
| `spoofAttemptDetected`  | Liveness check failed                    |
| `userIsNotRecognized`   | Face does not match enrolled user        |
| `selfieImageLowQuality` | Selfie image quality too low             |
| `hintNotProvided`       | Required authentication hint was not set |
| `faceNotFound`          | No face detected in frame                |
| `faceCroppingFailed`    | Face region could not be extracted       |
| `faceTooSmall`          | Face is too far from the camera          |
| `faceTooBlurry`         | Image is too blurry                      |
| `badPhotoQuality`       | General photo quality failure            |
| `processingError`       | Server-side processing error             |
| `badRequest`            | Malformed request                        |
| `unknown`               | Unexpected error                         |

### faceMatchData

From `addFaceMatch` and the non-UI `faceMatch`.

```js
{
  status: "match",              // "match" | "mismatch"
  confidence: 0.99,             // 0–1 match confidence
  existingUser: true,           // whether this is a returning user
  existingInterviewId: "",      // interview ID of the existing user if found
  isFaceMatched: true,
  isNameMatched: true,
  idCategory: "primary",        // "primary" | "secondary"
  nfcVsIdConfidence: 0,         // NFC vs ID face confidence (NFC flows only)
  nfcVsSelfieConfidence: 0      // NFC vs selfie confidence (NFC flows only)
}
```

_Older documentation may refer to&#x20;_`existingUser`_&#x20;as&#x20;_`isExistingUser`_; the current name is&#x20;_`existingUser`_._

### frontIdData

From `addId`.

```js
{
  status: "ok",              // see status values below
  image: "<base64String>",   // base64-encoded image
  classifiedIdType: "ID",    // classified document type, e.g. "ID"
  idCategory: "primary",     // "primary" | "secondary"
  chosenIdType: "id",        // "id" | "passport"
  allAttemptsExhausted: false // true when no more retries available
}
```

`status` values:

| Value                 | Meaning                         |
| --------------------- | ------------------------------- |
| `ok`                  | Capture succeeded               |
| `unknown`             | Unknown error                   |
| `errorClassification` | Document classification failed  |
| `errorGlare`          | Glare detected                  |
| `errorSharpness`      | Image not sharp enough          |
| `errorReadability`    | Document not readable           |
| `errorInCapture`      | Capture error (iOS)             |
| `errorUnacceptableID` | ID not acceptable (iOS)         |
| `wrongSide`           | Wrong document side shown (iOS) |

### geoLocationData

From `addGeolocation`.

```js
{
  addressFields: {
    city: "string",
    colony: "string",
    postalCode: "string",
    street: "string",
    state: "string"
  }
}
```

### govresult

From `addGovernmentValidation`.

```js
{ status: true } // boolean
```

### machineLearningConsentData

From `addMachineLearningConsent`.

```js
{ status: true } // boolean: true = consent given successfully
```

### nfcData

From `addNFC`. All MRZ and chip fields are extracted from the document chip. Date fields (`birthDate`, `expireAt`) follow the MRZ `YYMMDD` format returned by the document chip.

```js
{
  birthDate: "",
  compositeCheckDigit: "",
  dateOfBirthCheckDigit: "",
  documentCode: "",
  documentNumber: "",
  documentNumberCheckDigit: "",
  expirationDateCheckDigit: "",
  expireAt: "",
  gender: "",
  issuingStateOrOrganization: "",
  nationality: "",
  optionalData1: "",
  optionalData2: "",
  personalNumber: "",
  personalNumberCheckDigit: "",
  primaryIdentifier: "",
  secondaryIdentifier: "",
  status: true // boolean
}
```

### phoneData

From `addPhone`.

```js
{ phone: "+1234567890" }
```

### processIdData

From `addId` (added automatically via `processId`).

```js
{
  extendedOcrData: "<jsonString>", // raw JSON string with full OCR data
  data: {
    address: {
      city: "string",
      colony: "string",
      postalCode: "string",
      street: "string",
      state: "string"
    },
    fullAddress: "string",
    birthDate: 0,        // Unix timestamp in milliseconds
    expirationDate: 0,   // Unix timestamp
    gender: "string",
    name: "string",
    issueDate: 0,        // Unix timestamp
    numeroEmisionCredencial: "string"
  }
}
```

### selfieData

From `addSelfieScan`.

```js
{
  status: "success",          // "success" | "unknown"
  image: "<base64String>",    // base64-encoded selfie
  spoofAttempt: false,
  allAttemptsExhausted: false
}
```

### signatureData

From `addSignature`. Only fires when the signature is collected.

```js
{ status: "success" }
```

_Older documentation may refer to this key as&#x20;_`signaturePath`_; the current name is&#x20;_`signatureData`_._

### userConsentData

From `addUserConsent`.

```js
{ status: true } // boolean
```

### userScore result (inline)

When `userScore` is run inline via `{ module: "userScore", mode: "fast" }` in a `flowConfig`, the full score JSON object is included in the section result under the `userScoreData` key with the score data. This is passed through directly from the Incode API. See [`getUserScore()`](#getuserscore) for the shape.

### videoSelfieData

From `addVideoSelfie`.

```js
{ status: true } // boolean: true = success, false = failed
```

<br />
