> 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/push-to-the-digital-wallet.md).

# Push to the digital wallet

## Push to the digital wallet

Use this guide to push a card from the issuer application to a digital wallet application using the D1 SDK. Supported wallet applications are Google Pay, Samsung Pay, and Apple Pay.

Call this API when the end user taps **Add to wallet** and the card digitization state is `NOT_DIGITIZED`. To retrieve the state, see [Get the card digitization state](/push-provisioning/implement-push-provisioning/implement-push-to-digital-wallets/get-the-card-digitization-state.md).

### Overview

The issuer application calls the D1 SDK `addDigitalCardToOEM()` API to start the push provisioning flow. The D1 SDK and D1 backend:

* Validate the end user and card data stored in D1.
* Prepare the payload required by the wallet application and TSP.
* Call the wallet application to start Tokenization.
* Return the result so the issuer application can update the UI.

{% hint style="info" %}

* Only call `addDigitalCardToOEM()` after the D1 SDK returns `NOT_DIGITIZED` from `getCardDigitizationState()`.
* For Google Pay on Android, you must implement `onActivityResult` so that the wallet result is forwarded back to the D1 SDK.
* Starting June 10, 2024, [Google Wallet](https://developers.google.com/wallet/docs/release-notes?utm_source=chatgpt.com#June_04_2024) requires Android 9 or higher.
  {% endhint %}

### Flow

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

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

#### Sequence diagram

**Prerequisites**

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

<figure><img src="/files/2CqVhhzfscx0bh6LDRtP" alt="High-level sequence for pushing a card to a digital wallet"><figcaption><p>High-level sequence for pushing a card from the issuer application to a digital wallet using the D1 SDK.</p></figcaption></figure>

### Platform integration

{% tabs %}
{% tab title="Android" %}
For Android 2.4.0 and later, use `D1PushWallet.addDigitalCardToOEM()`.

```kotlin
//activity: Current activity for OEM Push Provisioning.
//cardID: Card ID received.
fun pushCardToWallet_v2_4_0(d1Task: D1Task, cardID: String, activity: Activity) {
    val wallet = OEMPayType.GOOGLE_PAY //GOOGLE_PAY, SAMSUNG_PAY, NONE
    val callback: D1Task.Callback<Any?> = object : D1Task.Callback<Any?> {

        override fun onSuccess(data: Any?) {
            // Handles the `digitalCardStatus` object from the server.
        }

        override fun onError(exception: D1Exception) {
            // Refer to D1 SDK Integration – Error Management section.
        }
    }
    val d1PushWallet : D1PushWallet = d1Task.d1PushWallet
    d1PushWallet.addDigitalCardToOEM(cardID, wallet, activity, callback)
}

// NOTE: Implement the `onActivityResult` method to forward all the callback events to the SDK.

// Activity Result: The `onActivityResult` method is received in the issuer app from GPay SDK, and passed back to D1 SDK to handle the result.
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    d1Task.handleCardResult(requestCode, resultCode, data);
}
```

{% endtab %}

{% tab title="iOS" %}
On iOS, use `addDigitalCardToOEM(_:viewController:completion:)`.

```swift
let cardID = "" // Obtained by the issuer application, for example from your backend
let viewController = /* current UIViewController instance presenting the Apple Pay UI */

d1Task.addDigitalCardToOEM(cardID, viewController: viewController) { error in
    if let error = error {
        // Refer to the D1 SDK integration error management section
    } else {
        // Update the UI, for example confirm that the card was added to Apple Wallet
    }
}
```

{% endtab %}
{% endtabs %}

For complete D1 SDK details, see the [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/push-to-the-digital-wallet.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.
