> 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/3d-secure/integrate-d1-sdk/get-started/3.-initialization/3ds-initialization.md).

# 3DS initialization

D1 SDK provides the facility to initialize the 3DS features. This must be done each time the application starts.

The issuer application will need to set up:

* UI callbacks for handling the user interactions initiated by 3DS for user verification.
* Push token used by the D1 SDK for [push notification](https://app.gitbook.com/o/fwy1mtbRONGA2YDKDBr0/s/62lLFDcmLCeqqwmy4Fee/integrate-d1-sdk/getting-started/configuration/4.-push-notifications/push-notification-configuration).

### Initialization steps

<figure><img src="/spaces/62lLFDcmLCeqqwmy4Fee/files/FZ39tUrj45jCQLIfqdvS" alt=""><figcaption><p>3DS initialization steps</p></figcaption></figure>

#### Init D1Authn

{% tabs %}
{% tab title="Android" %}
{% code overflow="wrap" lineNumbers="true" %}

```java
AuthnCallback authnCallback = new AuthnCallback() {
        @Override
        public void onTransactionDataConfirmation(@NonNull Map<String, String> map, @NonNull AuthnUserConfirmationCallback authnUserConfirmationCallback) {
            // Compose transaction details message using JSON payload received.
            String message = "";
            android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(activity)
                    .setTitle("Transaction Details")
                    .setMessage(message)
                    .setPositiveButton("OK", (dialog, which) -> {
                        authnUserConfirmationCallback.proceed();
                        dialog.dismiss();
                    }).setNegativeButton("Cancel", (dialog, which) -> {
                        authnUserConfirmationCallback.cancel();
                        dialog.dismiss();
                    });
            android.app.AlertDialog alertDialog = builder.create();
            alertDialog.setCanceledOnTouchOutside(false);
            alertDialog.show();
        }

        @NonNull
        @Override
        public String onBiometricPromptMessage() {
            return <Message to be displayed to the user during biometric prompt>
        }
};

D1Authn d1Authn = d1Task.getD1Authn(activity, authnCallback);
```

{% endcode %}
{% endtab %}

{% tab title="iOS" %}
{% code overflow="wrap" lineNumbers="true" %}

```swift
extension ViewController: AuthnDelegate {
    public func authn(_ authn: D1Authn, shouldConfirmTransactionData transactionData: [String : String], proceedHandler: (@escaping() -> Void), cancelHandler: (@escaping() -> Void)) {

        // Compose transaction details message using JSON payload received.
        var message = ""

        // Display the transaction details message to the end user, with the option to proceed or cancel.
        let alertController = UIAlertController(title: "Transaction Details", message: message, preferredStyle: .alert)
        alertController.addAction(UIAlertAction(title: "Proceed", style: .default, handler: { action in
            proceedHandler()
        }))
        alertController.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: {action in
            cancelHandler()
        }))
        present(alertController, animated: true)
    }

    public func authnTouchIDOperationPrompt(_ authn: D1Authn) -> String {
        return <Message to be displayed to the user during Touch ID verification>
    }
}

let d1Authn = d1Task.d1Authn(self)
```

{% endcode %}
{% 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/3d-secure/integrate-d1-sdk/get-started/3.-initialization/3ds-initialization.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.
