Initializing IdvService creates an IdvService object containing the user ID information. This object is then used in subsequent requests and messages sent to the ID Verification service. See the flow diagram in Flows for more information.

You’ll need to initialize IdvService using the 12-digit code, the QR code, or a retained configuration.

Prerequisites

Initializing IdvService

When ID verification is enabled for a user, the user initially will be presented with a 12-digit code and the URL for a QR code. You can initialize an IdvService object using either of these.

If ID verification has previously been successful for the user, the user’s ID information and transaction ID will still exist in secure storage on their device. In this case, you can use the retained configuration to initialize IdvService.

Initialize IdvService using the 12-digit code

For example:

IdvService.Builder.initWithNewConfigFor(verificationCode)
    .setApplicationId(APPLICATION_ID)
    .setPushNotificationToken(PUSH_TOKEN)
    .create(fragmentActivity, 
    (idvService) -> {
      //Use IdvService
    },
    (error) -> {
      //Handler IdvService initialization error here
    });

Initialize IdvService using the QR code URL

For example:

IdvService.Builder.initWithNewConfigFromQr(qrUrl)
    .setApplicationId(APPLICATION_ID)
    .setPushNotificationToken(PUSH_TOKEN)
    .create(fragmentActivity, 
    (idvService) -> {
      //Use IdvService
    },
    (error) -> {
      //Handler IdvService initialization error here
    });

Initialize IdvService using a retained configuration

For example:

IdvService.Builder.initWithSavedConfig()
    .setApplicationId(APPLICATION_ID) 
    .setPushNotificationToken(PUSH_TOKEN) 
    .create(fragmentActivity, 
    (idvService) -> {
      //Use IdvService
    },
    (error) -> {
      //Handler IdvService initialization error here
    });

See the IdvService.Builder or IdvService classes for more information.

Register NotificationHandler (optional)

To handle the verification result or any errors while processing notifications, you can register a NotificationHandler in IdvService.Builder. For example:

IdvService.Builder.initWithNewConfigFor(verificationCode)
    .setApplicationId(APPLICATION_ID)
    .setPushNotificationToken(PUSH_TOKEN)
    .setNotificationHandler(NOTIFICATION_HANDLER)
    .create(fragmentActivity, 
    (idvService) -> {
      //Use IdvService
    },
    (error) -> {
      //Handler IdvService initialization error here
    });