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

# デジタルウォレットへプッシュする

## デジタルウォレットにプッシュする

このガイドを使用して、D1 SDK を使い、イシュアアプリケーションからデジタルウォレットアプリケーションへカードをプッシュします。対応するウォレットアプリケーションは Google Pay、Samsung Pay、Apple Pay です。

エンドユーザーがタップしたときにこの API を呼び出します **ウォレットに追加** かつカードのデジタル化状態が `NOT_DIGITIZED`の場合。状態を取得するには、以下を参照してください [カードのデジタル化状態を取得する](/push-provisioning/ja/implement-push-provisioning/implement-push-to-digital-wallets/get-the-card-digitization-state.md).

### 概要

イシュアアプリケーションは D1 SDK を呼び出します `addDigitalCardToOEM()` API を使用して、プッシュ・プロビジョニング フローを開始します。D1 SDK と D1 バックエンドは次の処理を行います。

* D1 に保存されているエンドユーザーおよびカードデータを検証します。
* ウォレットアプリケーションと TSP に必要なペイロードを準備します。
* ウォレットアプリケーションを呼び出してトークナイゼーションを開始します。
* 結果を返し、イシュアアプリケーションが UI を更新できるようにします。

{% hint style="info" %}

* 以下の後にのみ `addDigitalCardToOEM()` を呼び出します `NOT_DIGITIZED` D1 SDK が返した `getCardDigitizationState()`.
* Android の Google Pay では、必ず `onActivityResult` を実装して、ウォレットの結果が D1 SDK に再度渡されるようにする必要があります。
* 2024 年 6 月 10 日以降、 [Google Wallet](https://developers.google.com/wallet/docs/release-notes?utm_source=chatgpt.com#June_04_2024) には Android 9 以上が必要です。
  {% endhint %}

### フロー

<figure><img src="/files/1302c1ddf3f9d71777ba613e0c9a85ffa246d587" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/3fe2300561477ff957ab5c2820df0effc24ccbe3" alt=""><figcaption></figcaption></figure>

#### シーケンス図

**前提条件**

* エンドユーザーとカードが D1 に登録されていること。
* D1 SDK が初期化されていること。
* イシュアアプリケーションが D1 SDK のログイン API を呼び出していること。

<figure><img src="/files/40c4a06b986054f480753077d6455bdf6ac41021" alt="High-level sequence for pushing a card to a digital wallet"><figcaption><p>D1 SDK を使用して、イシュアアプリケーションからデジタルウォレットへカードをプッシュする高レベルのシーケンス。</p></figcaption></figure>

### プラットフォーム統合

{% tabs %}
{% tab title="Android" %}
Android 2.4.0 以降では、次を使用してください `D1PushWallet.addDigitalCardToOEM()`.

```kotlin
//activity: OEM プッシュ・プロビジョニングの現在のアクティビティ。
//cardID: 受け取ったカード ID。
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?) {
            // サーバーからの `digitalCardStatus` オブジェクトを処理します。
        }

        override fun onError(exception: D1Exception) {
            // D1 SDK 統合 – エラー管理のセクションを参照してください。
        }
    }
    val d1PushWallet : D1PushWallet = d1Task.d1PushWallet
    d1PushWallet.addDigitalCardToOEM(cardID, wallet, activity, callback)
}

// NOTE: すべてのコールバックイベントを SDK に渡すために `onActivityResult` メソッドを実装してください。

// Activity Result: `onActivityResult` メソッドは GPay SDK からイシュアアプリで受信され、その結果を処理するために D1 SDK に返されます。
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
    d1Task.handleCardResult(requestCode, resultCode, data);
}
```

{% endtab %}

{% tab title="iOS" %}
iOS では、次を使用します `addDigitalCardToOEM(_:viewController:completion:)`.

```swift
let cardID = "" // イシュアアプリケーションによって取得された値。たとえばバックエンドから取得
let viewController = /* Apple Pay UI を表示している現在の UIViewController インスタンス */

d1Task.addDigitalCardToOEM(cardID, viewController: viewController) { error in
    if let error = error {
        // D1 SDK 統合のエラー管理セクションを参照してください
    } else {
        // UI を更新します。たとえば、カードが Apple Wallet に追加されたことを確認します
    }
}
```

{% endtab %}
{% endtabs %}

D1 SDK の詳細については、以下を参照してください [API リファレンス](/push-provisioning/ja/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/ja/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.
