> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-payment/implement-nfc-payment/make-payment/manage-payment-authentication/use-d1-sdk-authentication.md).

# Use D1 SDK authentication

### Overview

In this model, the issuer application starts authentication by calling the D1 SDK authentication API.

The D1 SDK then displays and manages the Android device authentication prompt.

The issuer application still manages the surrounding payment UX. It should show transaction progress, guide the end user, and handle success and error states.

### Flow

Implement `ContactlessTransactionListener::onAuthenticationRequired()` and call `startAuthenticate()` with an `AuthenticationParameter`.

Provide the activity context and the strings shown in the authentication prompt.

The D1 SDK manages the Android device authentication screen.

Do not start a separate Android device authentication flow in parallel.

{% hint style="info" %}
For devices running earlier than Android Q (API level 29), Android does not provide the system fingerprint prompt. On those devices, implement your own fingerprint UI before calling `startAuthenticate()`. We recommend always showing an authentication UI and then calling `startAuthenticate()`. On Android Q and later, the system authentication screen overlays the issuer application UI.
{% endhint %}

### SDK

{% tabs %}
{% tab title="Android Java" %}

```java
ContactlessTransactionListener paymentCallback = new ContactlessTransactionListener() {
    @Override
    public void onAuthenticationRequired(@NonNull VerificationMethod method) {
        // At this stage, the issuer application calls the D1 SDK
        // authentication API and lets the D1 SDK manage the
        // Android device authentication screen.

        // Create the AuthenticationParameter.
        AuthenticationParameter params = new AuthenticationParameter(
            activity, // The Activity that hosts authentication
            "Custom authentication title",
            "Custom authentication subtitle",
            "Authentication description", // Include the transaction amount
            "Cancel-button-label", // Label for the cancel button
            new DeviceAuthenticationCallback() {
                @Override
                public void onSuccess() {
                    // Authentication succeeds.
                    // The payment flow continues to the next stage: onReadyToTap().
                }

                @Override
                public void onFailed() {
                    // Authentication fails.
                    // The issuer application can ask the end user to retry
                    // by calling startAuthenticate() again.
                }

                @Override
                public void onHelp(int fpCode, @NonNull CharSequence fpDetail) {
                    // For biometric authentication only.
                    // The issuer application can show the fpDetail message.
                }

                @Override
                public void onError(int fpErrorCode) {
                    // For biometric authentication only.

                    // An error occurs during biometric authentication.
                    // For example, the sensor can be locked after multiple failed attempts.
                    // The issuer application should handle the error and guide the end user.
                }
            }
        );

        // Trigger authentication through the D1 SDK.
        startAuthenticate(params);
    }

    // ...
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.payments.thalescloud.io/nfc-payment/implement-nfc-payment/make-payment/manage-payment-authentication/use-d1-sdk-authentication.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
