SDK reference · iOS SDK / iOS Individual Modules

Government Validation

The Government Validation module validates identity data extracted from a user's ID against an authoritative government registry. It can also match the user's photo in the government database against their captured selfie. Whether the validation runs and what it checks also depend on your Incode Flow or Workflow configuration. The module is region-restricted and is currently supported only for Mexico.

For an overview of this module and how it works, see Government Data Verification and Government Record Verification.

How you use this module depends on your integration pattern. When the app defines the steps in code, you add the module to an IncdOnboardingFlowConfiguration as shown below; when the flow is defined in Dashboard, you reference it by ID. See Integration Approaches.

Availability: All variants; Mexico only.

UI: v1 + v2 (runs without a foreground screen when isBackgroundExecuted is true).

Add Government Validation

  1. Add an ID Capture or QR Scan module, and a Selfie module, before Government Validation. Government Validation depends on these earlier capture steps so there is document data and a face to validate. The SDK enforces this ordering when the flow is verified.

  2. Add the module with addGovernmentValidation().

    // Default configuration
    flowConfig.addGovernmentValidation()
    
    // Custom configuration — run without a foreground screen
    flowConfig.addGovernmentValidation(isBackgroundExecuted: true)
    

Example

The example below adds ID Capture and Selfie before Government Validation, then listens for the result through onGovernmentValidationCompleted(_:).

final class VerificationCoordinator: IncdOnboardingDelegate {

    func startVerification(sessionToken: String) {
        let session = IncdOnboardingSessionConfiguration(token: sessionToken)

        let flowConfig = IncdOnboardingFlowConfiguration()
        flowConfig.addIdScan(scanStep: .both)
        flowConfig.addSelfieScan()
        flowConfig.addGovernmentValidation(isBackgroundExecuted: false)

        IncdOnboardingManager.shared.startOnboarding(
            sessionConfig: session,
            flowConfig: flowConfig,
            delegate: self
        )
    }

    // MARK: - IncdOnboardingDelegate

    func onGovernmentValidationCompleted(_ result: GovernmentValidationResult) {
        // result.success indicates whether the validation passed
    }

    func onSuccess() { /* flow completed */ }

    func onError(_ error: IncdFlowError) {
        // Onboarding flow was aborted due to error
    }
}

Configuration Options

Configure the module with addGovernmentValidation().

Option Type Notes
isBackgroundExecuted Bool Determines if the service is run in the background without displaying a UI screen. Default is false.

Result

Government Validation signals completion through the onGovernmentValidationCompleted(_:) callback on IncdOnboardingDelegate. It does not return a result object from the add call.

func onGovernmentValidationCompleted(_ result: GovernmentValidationResult)

GovernmentValidationResult fields:

  • success: Bool: true if government validation completed successfully; otherwise, false.
  • error: IncdError?: The error when validation could not complete; otherwise, nil.

Errors that abort the whole onboarding flow, such as a network failure, surface through the delegate's onError(_:) callback with an IncdFlowError, not through this module callback.

Was this page helpful?