Actions in iOS SDK

Learn how to use applicant actions in iOS SDK.

To run the iOS SDK in applicant actions mode, you need to have:

  1. A verification level with Applicant actions. For more information on how to create such a level, see this article.
  2. An access token created with the userId, levelName, and externalActionId parameters.

Aside from the notes above, use the SDK the same way that you do with regular levels (see Basic Usage). Further processing, however, may differ depending on the action type.

The action type can be one of the following:

Additional Verification

Additional verification actions are processed identically to regular levels. You configure and manage the SDK the same way; nothing special is required.

🚧

Important

The Payment methods step is not supported at the moment.

Face Auth

Face authentication actions are handled in a specific manner:

  1. The user is taken directly to the FaceScan (Liveness) screen and once the action is complete, the SDK will be closed automatically.
  2. Upon completion, sdk.status is set to .actionCompleted and sdk.actionResult contains the outcome of the last action invocation.

You can use onDidDismiss, dismissHandler, or onStatusDidChange callback in order to determine the SDK status and get the action result.

For example:

sdk.onDidDismiss { (sdk) in

    switch sdk.status {

    case .failed:
        print("failReason: [\(sdk.description(for: sdk.failReason))] - \(sdk.verboseStatus)")

    case .actionCompleted:
        // the Face Auth action was performed or cancelled

        if let result = sdk.actionResult {
            print("Face Auth action result: actionId=\(result.actionId) answer=\(result.answer ?? "<none>")")
        } else {
            print("Face Auth action was cancelled")
        }

    default:
        // in case of Face Auth action, the other statuses are not used for now,
        // but you could see them if the user closes the sdk before the level is loaded
        break
    }
}

Action result

The Face Auth action result is represented by the sdk.actionResult property that contains the following fields:

FieldTypeDescription
actionIdStringFace Auth action identifier to check the results against the server.
answerStringOverall result. Typical values are GREEN, RED or ERROR.

The absence of the sdk.actionResult means that the user has cancelled the process.

Result handler

For Face Auth actions, there is an optional actionResultHandler that allows you to handle the action result upon its arrival from the backend. The user sees the Processing screen at this moment.

sdk.actionResultHandler { (sdk, result, onComplete) in

    print("Face Auth action result handler: actionId=\(result.actionId) answer=\(result.answer ?? "<none>")")

    // you are allowed to process the result asynchronously, just don't forget to call `onComplete` when you finish,
    // you could pass `.cancel` to force the user interface to close, or `.continue` to proceed as usual
    onComplete(.continue)
}

📘

Note

onComplete must be executed at the end of processing.