> 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/home/card-creation-and-management/secure-card-display/display-card-details.md).

# Display Card Details

## Overview

This guide explains how to securely display full card details (PAN, expiry date, cardholder name, and CVV2/dCVV2) with the D1 SDK.

You have two approaches:

* Get the card details and render them yourself in the issuer application UI.
* Delegate the rendering to the D1 SDK to minimize data exposure.

{% hint style="warning" %}
Avoid logging, analytics, or crash reports that could capture PAN, expiry date, cardholder name, or CVV2/dCVV2. Always wipe sensitive data from memory as soon as it is no longer needed.
{% endhint %}

## User experience

<figure><img src="https://1511816349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrnGS7C0Nw9iutILsGHpC%2Fuploads%2FYXDkKgki3wjWWHV5Lq4q%2FUX%20-%20Display%20card%20details.png?alt=media&amp;token=f92c6a35-76f7-4139-bfa6-25f69cf5d67f" alt=""><figcaption></figcaption></figure>

## Delegate display to the D1 SDK

To reduce PAN exposure, use `displayCardDetails`. Unlike `getCardDetails`, this API does not return card data. Instead, you pass UI components via `CardDetailsUI`, and the D1 SDK sets their text content securely. The issuer application retains full control of styling and layout.

{% hint style="warning" %}
This option supports Visa and Mastercard cards only. It does not support Amex cards because PAN length and rendering differ.
{% endhint %}

`CardDetailsUI` provides:

* `setPanMaskCharacter` to set the PAN mask character for `maskCardDetails` (default: `*`).
* `setPanSeparatorCharacter` to set the PAN separator every 4 digits (default: space).
* `setExpiryDateFormat` to set the expiry date format (default: `MM/YY`).
* `insecureCopyToClipboard` to copy the PAN to the system clipboard. Not recommended.

The following values can be displayed:

* PAN
* Expiry date
* Cardholder name (end user) — optional
* CVV2 or dCVV2

### Sequence diagram

#### Prerequisites:

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

<figure><img src="https://1511816349-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrnGS7C0Nw9iutILsGHpC%2Fuploads%2FtRLNQj9AyH9yfCAHcghn%2Fimage.png?alt=media&amp;token=fe718294-5f65-4938-9a0f-7a74ea9bd98e" alt=""><figcaption></figcaption></figure>

`CardDetailsUI` contains `DisplayTextView` (Android) and `D1DisplayTextField` (iOS), which subclass the native [TextView](https://developer.android.com/reference/android/widget/TextView) and [UITextField](https://developer.apple.com/documentation/uikit/uitextfield). To limit exposure, `getText()` is restricted.

Refer to the [Android security guidelines](broken://spaces/62lLFDcmLCeqqwmy4Fee/pages/BTDfMA1mlX4rlTjQbKSp) to obfuscate `DisplayTextView`.

### D1 SDK Integration

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

```kotlin
fun displayCardDetails(d1Task: D1Task, cardID: String, cardDetailsUI: CardDetailsUI, activity: FragmentActivity) {
    activity.lifecycleScope.launch(Dispatchers.Main) {
        try {
            d1Task.secureCardDisplayService.displayCardDetails(cardID, cardDetailsUI)
                .await()
            // UI is updated
        } catch (exception: D1Exception) {
            // Refer to D1 SDK Integration – Error Management section
        }
    }
    // UI is updated
}
```

{% endtab %}

{% tab title="Android < 4.4.0" %}

```kotlin
fun displayCardDetails (d1Task: D1Task) {

  var view: View? = null // Inflate your layout here.
  val panTextView: DisplayTextView? = null // view?.findViewById(R.id.panText)
  val expiryDateTextView: DisplayTextView? = null //view?.findViewById(R.id.expiryDateText)
  val cvvTextView: DisplayTextView? = null //view?.findViewById(R.id.cvvText)
  val cardHolderNameTextView: DisplayTextView? = null //view?.findViewById(R.id.cardHolderNameText)

  val cardDetailsUI = CardDetailsUI.getInstance(panTextView, expiryDateTextView,
  cvvTextView, cardHolderNameTextView)

  var cardID = "" // Card ID received from backend.
  val callback = object : D1Task.Callback<Void> {
      override fun onSuccess(ignore: Void?) {
        // UI is updated.
      }

      override fun onError(exception: D1Exception) {
        // Refer to D1 SDK Integration – Error Management section.
      }
    }

  d1Task.displayCardDetails(cardID, cardDetailsUI, callback)
}
```

{% endtab %}

{% tab title="iOS >= 4.4.0" %}

```swift
let panTextField = D1DisplayTextField()
let cvvTextField = D1DisplayTextField()
let expiryDateTextField = D1DisplayTextField()
let cardHolderNameTextField = D1DisplayTextField()

/* e.g. layout the textfields */

let cardDetailsUI = SecureCardDisplayService.CardDetailsUI(panTextField: panTextField,
                                                           expiryDateTextField: expiryDateTextField,
                                                           cvvTextField: cvvTextField,
                                                           cardHolderNameTextField: cardHolderNameTextField)

let cardID = "" // obtained e.g. from server
do {
    let service = try d1Task.secureCardDisplayService()
    try await service.displayCardDetails(cardID, cardDetailsUI: cardDetailsUI)
} catch let d1Error as D1Error {
    // Refer to D1 SDK Integration – Error Management section
} catch let error {
    // Handle other error
}
```

{% endtab %}

{% tab title="iOS < 4.4.0" %}

```swift
let panTextField = D1DisplayTextField()
let cvvTextField = D1DisplayTextField()
let expiryDateTextField = D1DisplayTextField()
let cardHolderNameTextField = D1DisplayTextField()

/* e.g. layout the textfields */

let cardDetailsUI = CardDetailsUI(panTextField: panTextField,
        expiryDateTextField: expiryDateTextField,
        cvvTextField: cvvTextField,
        cardHolderNameTextField: cardHolderNameTextField)

let cardID = "" // obtained e.g. from server
d1Task.displayCardDetails(cardID, cardDetailsUI: cardDetailsUI) { error in
    if let error = error {
        // Refer to D1 SDK Integration – Error Management section
    } else {
        // UI is updated
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="warning" %}
`insecureCopyToClipboard` exposes PAN to the system‑wide clipboard and is not recommended.
{% 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payments.thalescloud.io/home/card-creation-and-management/secure-card-display/display-card-details.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
