> 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/secure-card-display/implement-secure-card-display/display-card-metadata.md).

# Display Card Metadata

## Overview

This section describes how to display the non-sensitive card data in the issuer application.

## User experience

<div align="left"><figure><img src="/files/f8fB2D5oQwvDPyquwFCx" alt="" width="224"><figcaption></figcaption></figure></div>

## Sequence diagram

#### Prerequisites:

* End user and cards are registered in D1 backend.
* D1 SDK is properly initialised.
* Issuer application called D1 SDK login API.

<figure><img src="/files/bYX9Igzt06tbvBFOE610" alt=""><figcaption></figcaption></figure>

Based on the `cardID` value, the issuer application can display the basic information of the card to the end user such as the last four PAN digits, the expiry date, the card image background, and so on.

D1 SDK exposes the public `getCardMetaData()` API to get the card information. The `CardMetadata.cardAssetArray()` API for iOS and the `CardMetadata.getAssetList()` API for Android are provided to retrieve the card asset.

For a card issued by D1, additional card information such as “State Reason” and “Ongoing Operation” can be obtained using the CardMetadata.getStateReason() and CardMetadata.getOngoingOperation() APIs.

{% hint style="info" %}
The list of cards can be obtained with the `getCardList()` operation.
{% endhint %}

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

```java
String cardID = ""; //card id received from backend
D1Task.Callback<CardMetadata> callback = new D1Task.Callback<CardMetadata>() {
    @Override
    public void onSuccess(CardMetadata cardMetadata) {
        // Last 4 digits of PAN
        String last4Pan = cardMetadata.getLast4Pan();

        StateReason reason = cardMetadata.getStateReason();
        OngoingOperation ongoingOperation = cardMetadata.getOngoingOperation();

        // CardAsset is used to display Card Artwork
        cardMetadata.getAssetList(new D1Task.Callback<List<CardAsset>>() {
            @Override
            public void onSuccess(List<CardAsset> cardAssets) {
                // Proceeds with the application logic                                    
            }
            @Override
            public void onError(@NonNull D1Exception e) {
                // Handles the error. For example, log it, display it, and so on. 
            }
        });
    }

    @Override
    public void onError(D1Exception exception) {
        // Refer to D1 SDK Integration – Error Management section.
    }
};

d1Task.getCardMetadata(cardID, callback);
```

{% endtab %}

{% tab title="iOS" %}

```kotlin
let cardID = "" // Obtained for example, from server.
d1Task.cardMetadata(cardID) { cardMetadata, error in
    if let error = error {
        // Refer to D1 SDK Integration – Error Management section.
    } else if let cardMetadata = cardMetadata {
        // Proceeds with subsequent flows. For example, update UI.
        print("Scheme: \(cardMetadata.cardScheme.rawValue)")
        print("State: \(cardMetadata.cardState.rawValue)")
        print("Exp: \(cardMetadata.cardExpiry)")
        print("Last4: **** **** **** \(cardMetadata.cardLast4)")

        print("reason: \(cardMetadata.reason.rawValue)")
        print("Ongoing operation: \(cardMetadata.ongoingOperation.rawValue)")

        // For example, shows the first card artwork.
        cardMetadata.cardAssetArray { assets, error in
            if let cardAssetContent = assets?.first?.contentArray.first,
               let cardImageData = Data(base64Encoded: cardAssetContent.encodedData, options: .ignoreUnknownCharacters) {
                let image = UIImage.init(data: cardImageData)
            }
        }
    }
}
```

{% 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/secure-card-display/implement-secure-card-display/display-card-metadata.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.
