> 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/digitize-a-card/add-digital-card.md).

# Add digital card

### Overview

If the card is not digitized, prompt the end user to digitize it to enable NFC Payment.

### Flow

Use the D1 SDK in the issuer application to digitize the card when the end user enables NFC Payment.

The D1 SDK exposes the `addDigitalCard()` API for this flow.

### Sequence diagram

#### Prerequisites

* The end user, account, and card are already registered in D1.
* The D1 SDK is initialized.
* The issuer application has called the D1 SDK login API.

<figure><img src="/files/woEh2lmscEtsHHaoDgSd" alt=""><figcaption><p>Add digital card flow in the issuer application.</p></figcaption></figure>

### SDK

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

```kotlin
fun digitizeCardToD1Pay(d1Task: D1Task, cardID: String) {
    val d1PayWallet = d1Task.d1PayWallet

    val callback: D1Task.Callback<Void?> = object : D1Task.Callback<Void?> {
        override fun onSuccess(ignored: Void?) {
            // Digitization is successful.
        }

        override fun onError(exception: D1Exception) {
            // Refer to D1 SDK Integration – Error Management section
        }
    }
    d1PayWallet.addDigitalCard(cardID, callback)
}
```

{% endtab %}

{% tab title="Android Java" %}

```java
public void digitizeCardToD1Pay(@NonNull D1Task d1Task, @NonNull String cardID) {
    D1PayWallet d1PayWallet = d1Task.getD1PayWallet();
    D1Task.Callback<Void> callback = new D1Task.Callback<Void>() {
        @Override
        public void onSuccess(@Nullable Void ignored) {
            // Digitization is successful.
        }

        @Override
        public void onError(@NonNull D1Exception exception) {
            // Refer to D1 SDK Integration – Error Management section
        }
    };
    d1PayWallet.addDigitalCard(cardID, callback);
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
In D1 SDK flow, `onSuccess` means the card digitization is complete. The end user can use the digital card immediately after this callback.
{% endhint %}

{% hint style="warning" %}
In Android D1 SDK versions earlier than `4.1.0`, card digitization requires a push notification to complete.

* The issuer application must forward the push notification to the D1 SDK. See [Message Handling](https://docs.payments.thalescloud.io/nfc-payment/integrate-d1-sdk/getting-started/configuration/4.-push-notifications/message-handling).
* The issuer application must register `D1PayWallet.registerD1PayDataChangedListener()` and wait for `State.ACTIVE` before treating the digital card as ready for payment.
  {% endhint %}


---

# 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/digitize-a-card/add-digital-card.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.
