> 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-wallet-sdk-android/implement-nfc-wallet/manage-digital-cards/display-digital-cards.md).

# Display digital cards

## Overview

After **Tokenization**, your **digital wallet application** should show the **end user** their digital cards.

Provide a list view and a details view.

Use card status, card art, and metadata to drive the UI.

## SDK integration

### Use `DigitalizedCardManager` <a href="#digitalizedcardmanager" id="digitalizedcardmanager"></a>

After **Tokenization** completes, use `DigitalizedCardManager` to access the **NFC Wallet SDK** persistent data and retrieve digital cards.

`DigitalizedCardManager` supports asynchronous and blocking calls:

* `AsyncHandler`: Receive results via callbacks.
* `AsyncToken`: Block the calling thread until the operation completes.

{% hint style="warning" %}
`AsyncToken` blocks the calling thread. Avoid it on the UI thread.
{% endhint %}

### Retrieve card list

After **Tokenization** completes, use `DigitalizedCardManager.getAllCards()` to retrieve all **tokenized card IDs**.

For the difference between identifiers, see [Tokenized card ID versus digital card ID](#tokenized-card-id-versus-digital-card-id).

The examples below show how to retrieve tokenized card IDs with `AsyncHandler` and `AsyncToken`.

{% tabs %}
{% tab title="AsyncHandler" %}
{% code title="Retrieve tokenized card IDs using AsyncHandler" %}

```java
// Instantiate a HandlerThread to avoid work on the UI thread.
HandlerThread cardDisplayThread = new HandlerThread("getAllCards");
cardDisplayThread.start();

Looper looper = cardDisplayThread.getLooper();

AbstractAsyncHandler<String[]> handler = new AbstractAsyncHandler<String[]>(looper) {
    @Override
    public void onComplete(AsyncResult<String[]> result) {
        if (result.isSuccessful()) {
            String[] tokenizedCardIds = result.getResult();
            // TODO: display the cards
        } else {
            // TODO: handle error
        }
    }
};

DigitalizedCardManager.getAllCards(handler);
```

{% endcode %}
{% endtab %}

{% tab title="AsyncToken" %}
{% code title="Retrieve tokenized card IDs using AsyncToken (blocking)" %}

```java
AsyncToken<String[]> token = DigitalizedCardManager.getAllCards(null);
AsyncResult<String[]> result = token.waitToComplete();

if (result.isSuccessful()) {
    String[] tokenizedCardIds = result.getResult();
    // TODO: display the cards
} else {
    // TODO: handle error
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

### Tokenized card ID versus digital card ID <a href="#tokenized-card-id-versus-digital-card-id" id="tokenized-card-id-versus-digital-card-id"></a>

`DigitalizedCardManager` lists and retrieves cards using a **tokenized card ID**.

`DigitalizedCard.getTokenizedCardID()` returns the **tokenized card ID.**

This identifier is not the same as the **digital card ID**.

{% hint style="warning" %}
The **NFC Wallet SDK** uses two identifiers for the same card:

* **Tokenized card ID**: Generated during secure provisioning. Also known as a CPS token ID. See [Trigger provisioning](/nfc-wallet-sdk-android/implement-nfc-wallet/tokenize-a-card/trigger-provisioning.md).
* **Digital card ID**: Generated during digitization. Also known as an MG card ID. See [Digitize a card](/nfc-wallet-sdk-android/implement-nfc-wallet/tokenize-a-card/digitize-a-card.md).
  {% endhint %}

Use these helper methods to convert identifiers:

* `DigitalizedCardManager.getDigitalCardId()`: Get the digital card ID from a tokenized card ID.
* `DigitalizedCardManager.getTokenizedCardId()`: Get the tokenized card ID from a digital card ID.

{% hint style="info" %}
A TSP also provides its own digital card identifier.

Retrieve it in [Card metadata](#card-metadata).

Use it when troubleshooting with the TSP (VTS/MDES).

This identifier is different from the tokenized card ID and the digital card ID.
{% endhint %}

### Retrieve digital card information

#### Use `DigitalizedCard`

`DigitalizedCard` represents a digitized card and exposes card data, such as:

* `DigitalizedCardStatus`
  * Card state: `ACTIVE`, `SUSPENDED`
  * Payment keys status: Use it to detect replenishment needs.
* `DigitalizedCardDetails`
  * Last four digits of FPAN
  * Last four digits of DPAN
  * FPAN expiry date
  * Payment network (Visa, Mastercard, PURE)

Check whether a card is co-badged using `DigitalizedCard.hasAuxiliaryScheme()`.

Retrieve a `DigitalizedCard` from `DigitalizedCardManager` using the **tokenized card ID**.

#### Card metadata

Use `MGCardEnrollmentService.getCardMetaData()` and the **digital card ID** to retrieve card metadata, such as:

* TSP issuer name
* TSP ID (VTS, MDES, or another identifier)
* PAR (payment account reference)
* TSP digital card ID (`tokenId`)

For full field coverage, see the SDK API reference.

{% hint style="info" %}
TSP digital card ID (`tokenId`) maps to:

* Mastercard (MDES): `tokenUniqueReference`
* Visa (VTS): `tokenReferenceID`
  {% endhint %}

#### Card art

Use `MobileGatewayManager.getCardArt()` and the **digital card ID** to retrieve `CardArt`.

Use `CardArt.getBitmap()` to retrieve the card images:

* `BANK_LOGO`: Issuer logo
* `CARD_BACKGROUND`: Card background
* `CARD_BACKGROUND_COMBINED`: Card background combined with the payment network
* `CARD_ICON`: Card icon

{% hint style="warning" %}
Retrieving card art trigger network requests. Cache images in the **digital wallet application**.
{% endhint %}

The sample application demonstrates a simple local caching approach:

{% code title="Cache card art locally" %}

```java
public void getCardArt(final Context context, final String digitalCardId) {
    // First check if we already have the image locally.
    final byte[] imageBytes = readFromFile(context, digitalCardId);

    if (imageBytes.length > 0) {
        final Drawable image = new BitmapDrawable(
                context.getResources(),
                BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length)
        );
        // TODO: return image
        return;
    }

    // Download card art data from the backend.
    final MobileGatewayManager gatewayManager = MobileGatewayManager.INSTANCE;
    try {
        final CardArt cardArt = gatewayManager.getCardArt(digitalCardId);
        cardArt.getBitmap(
                CardArtType.CARD_BACKGROUND_COMBINED,
                new AsyncHandlerCardBitmap(new AsyncHandlerCardBitmap.Delegate() {
                    @Override
                    public void onSuccess(final CardBitmap value) {
                        // Store current data for future use.
                        writeToFile(context, digitalCardId, value.getResource());

                        final Drawable image = new BitmapDrawable(
                                context.getResources(),
                                BitmapFactory.decodeByteArray(value.getResource(), 0, value.getResource().length)
                        );
                        // TODO: return image
                    }

                    @Override
                    public void onError(final String error) {
                        // TODO: log error
                    }
                })
        );
    } catch (final NoSuchCardException exception) {
        // TODO: log error
    }
}
```

{% endcode %}


---

# 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-wallet-sdk-android/implement-nfc-wallet/manage-digital-cards/display-digital-cards.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.
