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 authentication

🚧

Important

The Face authentication action type will soon be fully deprecated in level configurations within the SDK.

  • To use Liveness as an action in your verification process, you need to configure a Selfie → Advanced Liveness check step for the regular Applicant actions level. New actions will run using this level, while existing actions created under the previous configuration will continue to work. To learn how to set up an Applicant actions level, refer to this article.
  • For Mobile SDK, the optional handler for receiving the Face authentication action result will be removed as part of the deprecation of this action type. Use the standard SDK flow instead — Additional verification with Liveness relies on the same callbacks, such as Pending, Temporary Declined, Finally Rejected, Approved, and so on. For more details, see the MobileSDK section.

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 authentication 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 authentication 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
    }
}

Get Face authentication action result

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

FieldTypeDescription
actionIdStringFace authentication 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.

Handle Face authentication action result

For Face authentication 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)
}

onComplete must be executed at the end of processing.