Journey Result

Retrieve and handle journey verification results using getJourneyResult() in the IDWise Web SDK.

Overview

Call getJourneyResult() after a journey finishes to retrieve the verification outcome — including the system decision, document and selfie results, and rule evaluations.


When to Call getJourneyResult()

Call getJourneyResult() inside the onJourneyFinished callback. This callback fires after the user completes all steps and the journey finishes processing. Calling it before this point returns a JOURNEY_NOT_COMPLETED error.

eventHandlers: {
  onJourneyFinished: async () => {
    const result = await idwise.getJourneyResult();
    // result is now available
  }
}

Sample Response

A complete JourneyResult object looks like this:

{
    "isCompleted": true,
    "systemDecision": "Rejected",
    "referenceNo": "Web SDK Test",
    "journeyId": "600000000000000000b9",
    "documents": {
        "20": {
            "step_title": "ID Document",
            "step_id": 20,
            "has_passed_rules": false,
            "document_type": "Identity Card",
            "document_subtype": null,
            "issuing_country": "Netherlands",
            "issuing_country_code": "NLD",
            "extracted_fields": {
                "Full Name": {
                    "value": "Willeke Liselotte De Bruijn"
                },
                "Nationality Native": {
                    "value": "Nederlandse"
                },
                "Signature": {
                    "value": null
                }
            }
        },
        "50": {
            "step_title": "Proof of Address",
            "step_id": 50,
            "has_passed_rules": true,
            "document_type": "",
            "document_subtype": "",
            "issuing_country": "",
            "issuing_country_code": "",
            "extracted_fields": {}
        }
    },
    "selfie": {
        "status": "Refer",
        "has_passed_rules": false,
        "is_live": false,
        "liveness_status_code": "FACE_NOT_FOUND"
    },
    "rules": {
        "unrecognized_document": {
            "name": "Recognised Document",
            "result": "Passed"
        },
        "document_validation": {
            "name": "Authentic Document",
            "result": "Failed"
        },
        "expired_document": {
            "name": "Expired Document",
            "result": "Failed"
        }
    }
}

Data Models

JourneyResult Object

This is the object returned by getJourneyResult():

FieldTypeDescription
isCompletedbooleantrue if the journey has finished processing
systemDecisionstringComplete, Rejected, Refer. Check the table below for details.
journeyIdstringUnique identifier for the journey
referenceNostringReference number provided during initialization
documentsRecord<string, DocumentResult>Dictionary of document results keyed by step ID. Check the table below for details.
selfieRecord<string, SelfieResult> Selfie verification results. Check the table below for details.
rulesRecord<string, RuleDetail>Dictionary of rule results. Check the table below for details.

System Decision Values

The systemDecision field indicates the overall verification outcome:

DecisionMeaningRecommended Action
CompleteAll verification checks passed.Allow the user to proceed.
RejectedOne or more checks failed and the user did not pass verification.Block the user and display a rejection message.
ReferThe system could not make a definitive decision. Manual review is required.Queue the journey for manual review by your compliance team.

DocumentResult Object

Each entry in the documents dictionary describes the result for one document step:

FieldTypeDescription
step_titlestringTitle of the journey step that collected the document.
step_idnumberNumeric identifier of the document step.
has_passed_rulesbooleantrue if the document passed the configured document-level rules.
document_typestringDetected document type, such as Identity Card or passport.
document_subtypestring / nullMore specific document classification when available.
issuing_countrystringFull name of the country that issued the document.
issuing_country_codestringCountry code for the issuing country.
extracted_fieldsRecord<string, ExtractedField>OCR-extracted fields returned for the document, keyed by field name.

ExtractedField Object

Each entry in extracted_fields represents one OCR-extracted field from the document:

The key is the field name returned by OCR, such as Full Name, Nationality Native, or Signature.

FieldTypeDescription
valuestring / nullExtracted value for the field. This is null when the field is present but no value could be extracted.

Example:

{
  "Full Name": {
    "value": "Willeke Liselotte De Bruijn"
  },
  "Signature": {
    "value": null
  }
}

SelfieResult Object

The selfie object describes the selfie and liveness verification outcome:

FieldTypeDescription
statusstringOverall selfie verification result, such as Refer.
has_passed_rulesbooleantrue if the selfie passed the configured selfie-related rules.
is_livebooleantrue if the liveness check detected a live person.
liveness_status_codestringDetailed liveness result code, such as FACE_NOT_FOUND.

RuleDetail Object

Each entry in the rules dictionary describes a single verification rule and its outcome:

FieldTypeDescription
namestringHuman-readable name of the rule (e.g., "Document Expiry Check")
resultstringPassed, Failed, or CouldNotApply

Result values:

  • Passed — The rule's conditions were met.
  • Failed — The rule's conditions were not met (e.g., the document is expired).
  • CouldNotApply — The rule could not be evaluated, usually because the required data was missing or unreadable.

Example:

{
  name: "Document Expiry Check",
  result: "Passed" // "Passed" | "Failed" | "CouldNotApply"
}

Errors Handling

If the request cannot be fulfilled, the SDK returns an error object:

{
  "code": "STRING",
  "message": "STRING"
}
FieldTypeDescription
codestringIdentify the failure type and handle it programmatically.
messagestringExplanation of the error that describes what went wrong and what you should check next.

Error Codes

Error CodeDescription
JOURNEY_NOT_COMPLETEDProcessing is still underway. Call this only after onJourneyFinished.
TIMEOUTNetwork failure or API timeout. Check the internet connection.
EMPTY_PARAMETERSJourney ID is missing. Ensure startJourney was called first.
POLLING_ALREADY_RUNNINGA verification process is already active. Avoid duplicate calls.

Implementation Example

This example initializes the SDK, starts a journey, and handles the result based on the systemDecision:

const idwise = await IDWise.initialize({ clientKey: "YOUR_KEY" });

idwise.startJourney({
  mount: "#idwise-mount",
  journeyDefinitionId: "YOUR_JOURNEY_ID",
  eventHandlers: {
    onJourneyFinished: async () => {
      try {
        const result = await idwise.getJourneyResult();

        if (!result.isCompleted) {
          console.warn("Journey not yet fully processed.");
          return;
        }

        // Route based on the system decision
        switch (result.systemDecision) {
          case "Complete":
            console.log("Verification passed for journey:", result.journeyId);
            // All checks in the journey passed, so you can continue onboarding.
            break;
          case "Rejected":
            console.log("Verification rejected for journey:", result.journeyId);
            // At least one rule failed with an action on failure set to reject.
            // The user did not pass verification, so you should stop the flow.
            break;
          case "Refer":
            console.log("Manual review needed for journey:", result.journeyId);
            // At least one rule failed with an action on failure set to refer.
            // Send the journey for manual review before making a final decision.
            break;
        }

        // Inspect individual rule outcomes
        for (const [ruleId, rule] of Object.entries(result.rules)) {
          if (rule.result === "Failed") {
            console.warn(`Rule failed: ${rule.name} (${ruleId})`);
          }
        }

      } catch (error) {
        // Handle specific error codes
        switch (error.code) {
          case "JOURNEY_NOT_COMPLETED":
            console.warn("Journey is still processing. Wait for onJourneyFinished.");
            break;
          case "TIMEOUT":
            console.error("Request timed out. Check network connectivity.");
            break;
          case "EMPTY_PARAMETERS":
            console.error("Journey ID is missing. Ensure startJourney was called.");
            break;
          case "POLLING_ALREADY_RUNNING":
            console.warn("A result request is already in progress.");
            break;
          default:
            console.error("Unexpected error:", error.code, error.message);
        }
      }
    }
  }
});