Flutter plugin

Requirements and prerequisites

Requirements

Veriff Flutter Plugin requires the project to target:

  • iOS minimum version 11.0 or higher

  • Android minimum version 8.0 (api 26) or higher

Prerequisites

  • You have an active account with Veriff (see the Getting Started section)

  • You have an integration with Veriff (see the Getting Started section)

  • You have set up webhook(s) to get replies from Veriff (see the Webhooks section)


Add SDK to the project

Follow instructions here[↗] to install the plugin.


Add permissions

iOS specific configuration

Usage descriptions

Veriff requires camera, microphone, photo library and optionally NFC reader permissions for capturing photos, video and scanning passports or ID cards during identification. Your application is responsible for describing the reason why camera, microphone, photo library and NFC reader are used. You need to add the three descriptions listed below to the Info.plist file of your application with the explanation of the usage.

  • NSCameraUsageDescription
  • NSMicrophoneUsageDescription
  • NSPhotoLibraryUsageDescription

Not adding these permissions will cause the system to shut down the application when it requests the permissions.

NFC scanning permissions

  1. Add NFCReaderUsageDescription description to Info.plist.
  2. In the Info.plist file, define the list of application IDs or AIDs it can connect to (the AID is a way of uniquely identifying an application on a ISO 7816 tag, which is usually defined by a standard)
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
	<string>D23300000045737445494420763335</string>
	<string>A0000002471001</string>
	<string>A0000002472001</string>
	<string>00000000000000</string>
</array>
  1. Introduce a new entitlement for NFC scanning, a feature made available from iOS 13 onwards. Xcode automatically adds this entitlement when you activate the Near Field Communication Tag Reading feature in the target Signing & Capabilities. Following the activation of this feature, the *.entitlements file should include the TAG format.
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
    <string>TAG</string>
</array>

Set the iOS target in Xcode

Make sure that the iOS Deployment Target in Xcode (under Project > target > Info > Deployment Target) is set to iOS 11.0 or later.


Start the verification flow

Step 1: Import Veriff plugin to your class that will use it

import 'package:veriff_flutter/veriff_flutter.dart'

Step 2: Create a configuration as shown below with the defined parameters

Configuration config = Configuration(sessionUrl);

Parameters

Description

sessionUrl*

A combination of the base URL and the sessionToken, created as soon as a verification session is created. You can find its value in the response payload of your POST /sessions[↗] call, as verification.url. See Create a verification session article for more info.

* Required parameter

Step 3: Pass the configuration to Veriff object and start the verification flow

Veriff veriff = Veriff();

try {
      Result result = await veriff.start(config);
      print(result.status);
      print(result.error);
    } on PlatformException {
      // handle exception
    }

What happens after the end-user leaves the flow?

When the end-user leaves the verification flow, i.e. a session is canceled or finished, the Veriff SDK is closed. The end-user is taken back to your application. The end-user flow completion status is returned to the host application, see Verification session status explanation below for more info.


Verification session status

The result returned by start method will have a status that is one of Status.done, Status.canceled and Status.error.

This is not the verification session decision.

This indicates whether the end-user was able to complete all the steps in the verification flow or not.

In case Status.error is received, you will also have an error description that is one of the list below:

  • Error.cameraUnavailable

  • Error.microphoneUnavailable

  • Error.networkError

  • Error.sessionError

  • Error.deprecatedSDKVersion

  • Error.unknown

  • Error.nfcError

  • Error.setupError

  • Error.none

You can check the statuses and errors using switch-case as in example below:

switch (result.status) {
        case Status.done:
          print("Session is completed.");
          break;
        case Status.canceled:
          print("Session is canceled by the end-user.");
          break;
        case Status.error:
          switch (result.error) {
            case Error.cameraUnavailable:
              print("User did not give permission for the camera");
              break;
            case Error.microphoneUnavailable:
              print("User did not give permission for the microphone.");
              break;
            case Error.networkError:
              print("Network error occurred.");
              break;
            case Error.sessionError:
              print("A local error happened before submitting the session.");
              break;
            case Error.deprecatedSDKVersion:
              print(
                  "Version of Veriff SDK used in plugin has been deprecated. Please update to the latest version.");
              break;
            case Error.unknown:
              print("Uknown error occurred.");
              break;
            case Error.nfcError:
              print("Error with NFC");
              break;
            case Error.setupError:
              print("Error with setup");
              break;
            case Error.none:
              print("No error.");
              break;
            default:
              break;
          }
          break;
        default:
          break;
}


Verification session decision

Veriff returns info about the verification session decision, extracted data, registries checks etc via webhooks. You need to set up webhooks and tie them to your system.

→ See Webhooks Guide > Set up webhooks sub-section for detailed overview of the setup process


Customize the SDK

SDK customization is optional

It is possible to customize the look and feel of the UI to match your branding. You can change primitives such as colors and fonts, set the language settings for the SDK, and change if/how an intro screen is displayed.

Match the brand

Veriff Flutter plugin allows the customization of your brand's colors, font and logo in the SDK flow.

Note: all custom values for branding are optional. If a value is not provided for them, the default Veriff color and logo will be used.

Step 1: Pass the optional parameters when launching Veriff:

String regularFontPath = "fonts/Regular.otf";
String mediumFontPath = "fonts/Medium.otf";
String boldFontPath = "fonts/Bold.otf";
Fonts fonts = Fonts(
    regularFontPath: regularFontPath, 
    mediumFontPath: mediumFontPath, 
    boldFontPath: boldFontPath
);
Branding branding = Branding(
    logo: AssetImage(path_of_image),
    background: "#f2ff00",
    onBackground: "#ff00ff",
    onBackgroundSecondary: "#52b35c",
    onBackgroundTertiary: "#3a593d",
    primary: "#123abc",
    onPrimary: "#ff00ff",
    secondary: "#f2ff00",
    onSecondary: "#ff7700",
    cameraOverlay: "#59496a",
    onCameraOverlay: "#e27e23",
    outline: "#ff00ff",
    error: "#ff0000",
    success: "#00ff00",
    buttonRadius: 5,
    fonts: fonts
);

Step 2: Pass the branding object with configuration for starting the verification flow:

Configuration config = Configuration(sessionUrl, branding: branding);

→ See the Visual SDK customization guides article for design examples

Intro screen

It is possible to customise if the end-user flow begins with Veriff intro screen or no intro screen at all.

In some cases, it is possible to skip the Veriff’s generic introduction screen and use your own before Veriff’s SDK is launched.

Check with your Solutions Engineer to confirm if this feature can be enabled for your integration

If it is possible, the the following will happen:

  • You agree your own introduction screen visuals and copy with our Solutions Engineer and get relevant legal documents signed in case they are needed

  • After that Veriff will enable custom introduction screen from backend for your integrations

  • After you have implemented your own introduction screen you can change the configuration option specified below

config.useCustomIntroScreen = true;

Adding the configuration alone in your app is not enough to enable the custom intro screen. Make sure to contact your solutions engineer so they can enable the feature for your integration.

User interface language settings

Veriff Flutter plugin supports setting the language of the UI. In order to use this feature, pass the locale identifier as in example below:

Configuration config = Configuration(sessionUrl, branding: branding, languageLocale: "et");

→ See Supported languages in SDKs article for more info