Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.
For the complete documentation index, see llms.txt. This page is also available as Markdown.

5. Perform CDCVM verification

Overview

During a contactless transaction, NFC Wallet SDK can require the end user to authenticate to complete CDCVM verification.

Your digital wallet application must perform this authentication using the CDCVM method you configured earlier. See Set CDCVM method.

SDK integration

Handle authentication in ContactlessPaymentServiceListener.onAuthenticationRequired(). See Implement contactless payment callbacks.

To authenticate the end user, use the CHVerificationMethod provided by the SDK. Use it to obtain a DeviceCVMVerifier instance, then start authentication and listen for the result using DeviceCVMVerifyListener.

cvmResetTimeout tells you how long the verification stays valid. Use it to guide the end user for the second tap.

CDCVM verification with device keyguard

When the device keyguard is used as the CDCVM method:

//From a ContactlessPaymentServiceListener() implementation
//...

@Override
public void onAuthenticationRequired(
  PaymentService activatedPaymentService,
  CHVerificationMethod cvm,
  long cvmResetTimeout) {

    // check the CDCVM type
    if(cvm == CHVerificationMethod.DEVICE_KEYGUARD) {
        // Launch the Activity implemented to manage the Keyguard authentication screen
        // In this example the activity is called 'KeyguardActivity'
        Intent intent = new Intent(getApplicationContext(), KeyguardActivity.class);
        intent.putExtra(Tags.CVM, cvm);
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}

//...

Implement KeyguardActivity in your digital wallet application. It must extend DeviceCVMKeyguardActivity. This enables CDCVM verification using device credentials.

The following example shows the implementation of the KeyguardActivity class:

CDCVM verification with biometrics (fingerprint example)

Use this method when the device supports biometric authentication (fingerprint is shown in the example).

The following example shows how this mechanism can be implemented:

Implement a dedicated Activity that extends DeviceCVMKeyguardActivity. This enables fallback to device keyguard when biometric verification fails.

If the digital wallet application goes to the background, stop listening for fingerprint authentication.

This can be accomplished using the following code snippet:

Support lock screen scenarios (optional)

If you need to support authentication prompts when the device is locked, verify the following:

  • Activities shown during payment are declared with showOnLockScreen=true.

  • A wake lock is acquired and window flags are set to show the UI on the lock screen.

  • Release the wakeLock when the payment completes to reduce battery usage.

Configure the following settings in the manifest, and implement the sample code as needed:

Delegated authentication

Delegated authentication lets your digital wallet application prompt the end user for authentication and then inform the SDK that the payment can proceed.

The authentication can use device keyguard or biometrics to unlock the underlying keystore protected by user authentication.

This flow applies when the SDK requests authentication during payment. Your digital wallet application can either:

  • Prompt the end user for authentication, then call DeviceCVMVerifier.onDelegatedAuthPerformed(timeOfAuth).

  • Reuse a recent successful authentication (within the configured key validity period) and call DeviceCVMVerifier.onDelegatedAuthPerformed(timeOfAuth) immediately.

If the end user aborts the transaction, call DeviceCVMVerifier.onDelegatedAuthCancelled().

Last updated

Was this helpful?