> 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/push-provisioning/implement-push-provisioning/implement-push-to-digital-wallets/get-the-card-digitization-state.md).

# Get the card digitization state

## Get the card digitization state

Use this guide to determine whether a card is already digitized in a specific wallet on the device. The issuer application uses this state to decide whether to show **Add to wallet** or **Activate card**, or to hide both.

You typically call this API when:

* the issuer application starts, or
* the end user opens a card details screen.

For the overall push provisioning flow, see [Implement push to digital wallets](/push-provisioning/implement-push-provisioning/implement-push-to-digital-wallets.md).

### Overview

The issuer application uses the D1 SDK to check the card Tokenization status in the mobile device. Based on the returned state, the issuer application updates the UI:

* `DIGITIZED` – The card is already tokenized in the wallet on this device. Hide **Add to wallet** and **Activate card**.
* `NOT_DIGITIZED` – The card is not tokenized. Show **Add to wallet**.
* `PENDING_IDV` – The digital card is created but pending ID\&V. Show **Activate card** if in-app authentication is supported.

{% hint style="warning" %}
**Caution**

* If the card still appears as `NOT_DIGITIZED` after digitization, check that the issuer application is correctly configured in the TSP portal.
* For Samsung Pay, some issuers must register multiple issuer names in the portal. Ensure the issuer name used in the API matches the names registered in the portal. Only exact matches are returned. See the [Samsung FAQ](https://developer.samsung.com/pay/native/sdk-faq.html) for troubleshooting tips.
  {% endhint %}

### Flow

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

#### Sequence diagram

**Pre-requisites**

* Consumer account and card were registered in D1
* SDK is properly initialized
* Issuer App called D1 SDK login API

<figure><img src="/files/W9aHs2JevfqRtMa9CBxS" alt="High-level sequence for getting the card digitization state"><figcaption><p>High-level sequence to retrieve the card digitization state from the wallet.</p></figcaption></figure>

### Platform integration

{% tabs %}
{% tab title="Android" %}
For Android 2.4.0 and later, the D1 SDK exposes the `D1PushWallet.getCardDigitizationState()` API to check the card Tokenization state for a specific wallet (Google Pay or Samsung Pay).

The possible states are:

* `DIGITIZED`\
  The card has already been tokenized. No message or action is required.
* `NOT_DIGITIZED`\
  Show an **Add to Google/Samsung Pay** button. Refer to the Google Pay [brand guidelines](https://developers.google.com/pay/issuers/apis/push-provisioning/android/branding-guidelines?hl=en) for more information. The next step is to push the card into the wallet as explained in [Push to the digital wallet](/push-provisioning/implement-push-provisioning/implement-push-to-digital-wallets/push-to-the-digital-wallet.md).
* `PENDING_IDV`\
  Show an **Activate card** button if issuer application authentication is supported. After successful authentication, call `activateDigitalCard()` to activate the digital card.

See the D1 SDK reference for the full API signature.

```kotlin
fun checkCardDigitizationState_v2_4_0(d1Task: D1Task, cardID: String) {
    val d1PushWallet = d1Task.d1PushWallet
    val wallet = OEMPayType.GOOGLE_PAY // it can be SAMSUNG_PAY

    val callback: D1Task.Callback<CardDigitizationState> = object : D1Task.Callback<CardDigitizationState> {

        override fun onSuccess(state: CardDigitizationState) {
            // Updates the UI based on the state value.

            // Hides the  "Add to Google/Samsung Pay" button.
            // Hides the "Activate your card" button.
            when (state) {
                NOT_DIGITIZED -> {
                    // Shows the "Add to Google/Samsung Pay" button.
                }
                PENDING_IDV -> {
                    // 1. Show the "Activate your card" button.
                    // 2. Authenticate the end user.
                    // 3. Perform activation: d1PushWallet.activateDigitalCard(cardID, wallet, callback)
                }
                DIGITIZED -> {
                    // Hides the "Add to Google/Samsung Pay" button.
                }
                else -> {
                    //Do nothing.
                }
            }
        }

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

{% endtab %}

{% tab title="iOS" %}
On iOS, the D1 SDK returns a `CardDigitizationResult` object that includes:

* the `CardDigitizationState`, and
* optional [`PKPass`](https://developer.apple.com/documentation/passkit/pkpass) objects (`localPKPass` and `remotePKPass`) that can be used to display device-specific information such as `deviceName`.

The possible states are:

* `digitized`\
  The card is already tokenized. Hide **Add to Apple Wallet**.
* `notDigitized`\
  Display a [`PKAddPassButton`](https://developer.apple.com/documentation/passkit/pkaddpassbutton). This state is returned when at least one device (for example, iPhone or paired Apple Watch) is not yet tokenized.
* `pendingIDVLocal` / `pendingIDVRemote`\
  Tokenization is pending ID\&V for either the phone (`pendingIDVLocal`) or the watch (`pendingIDVRemote`). Show an appropriate **Activate on your phone/watch** button, authenticate the end user in the issuer application, then call `activateDigitalCard()`.

```swift
import PassKit

let digitizeCardButton: PKAddPassButton = /* existing Add to Wallet button in your UI */
let activateCardButton: UIButton = /* existing Activate button in your UI */
let cardID = "" // Obtained by the issuer application, for example from your backend

d1Task.cardDigitizationState(cardID) { result, error in
    if let error = error {
        // Handle error
    } else if let result = result {
        // Update the UI based on the state
        switch result.state {
        case .pendingIDVLocal:
            activateCardButton.isHidden = false
            activateCardButton.setTitle("Activate on your phone \(result.localPKPass?.deviceName ?? "")", for: .normal)
            digitizeCardButton.isHidden = true
            // After authenticating the end user, call: d1Task.activateDigitalCard(cardID)

        case .pendingIDVRemote:
            activateCardButton.isHidden = false
            activateCardButton.setTitle("Activate on your watch \(result.remotePKPass?.deviceName ?? "")", for: .normal)
            digitizeCardButton.isHidden = true
            // After authenticating the end user, call: d1Task.activateDigitalCard(cardID)

        case .notDigitized:
            activateCardButton.isHidden = true
            digitizeCardButton.isHidden = false

        case .digitized:
            activateCardButton.isHidden = true
            digitizeCardButton.isHidden = true
        }
    }
}
```

{% endtab %}
{% endtabs %}

For a full access to the D1 SDK, please check [API reference](/push-provisioning/integrate-the-d1-sdk/api-reference.md).


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.payments.thalescloud.io/push-provisioning/implement-push-provisioning/implement-push-to-digital-wallets/get-the-card-digitization-state.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
