> 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-scheme/push-to-token-requestors-token-connect.md).

# トークンリクエスタへのプッシュ（Token Connect）

## トークンリクエスタへのプッシュ（Token Connect）

このガイドを使用して、イシュアアプリケーションからカードを **トークンリクエスタ** 〜を使用して **Mastercard MDES Token Connect**.

トークンリクエスタには、eコマース加盟店やウォレットプロバイダーが含まれる場合があります。

Mastercardの製品ドキュメントについては、次を参照してください [MDES Token Connectの概要](https://developer.mastercard.com/mdes-token-connect/documentation/#overview).

### 概要

Token Connectでは、イシュアアプリケーションは次のことを行います:

1. カードに対する対象トークンリクエスタの一覧を取得します。
2. 〜を要求します **push URL** 選択されたトークンリクエスタに対して。
3. 完了のために、エンドユーザーをトークンリクエスタの体験へリダイレクトします **トークン化**.

{% hint style="info" %}
**前提条件**

* エンドユーザーはイシュアアプリケーションで認証済みです。
* イシュアアプリケーションはD1 SDKを初期化し、ログインを完了しています。
* 消費者とカードはD1に登録されています。
  {% endhint %}

### エンドユーザー体験

下の図は、代表的なToken Connectフローを示しています。同じパターンは、Token Connect準拠の任意のトークンリクエスタに適用されます。

<figure><img src="/files/24ff319c9410c1c14459003373d7ef27338c6409" alt=""><figcaption><p>Token Connectを使用してカードをトークンリクエスタにプッシュする際のエンドユーザー体験の例。</p></figcaption></figure>

### フロー

#### 対象のトークンリクエスタを取得

<figure><img src="/files/87f4363454ab5236f1b7a522566580db49ff96ca" alt=""><figcaption><p>カードに対する対象トークンリクエスタを取得します。</p></figcaption></figure>

#### トークンリクエスタへプッシュ

<figure><img src="/files/8dcfe3cc720741b3b53b3e4b08cc1be6dac03d66" alt=""><figcaption><p>選択したトークンリクエスタ用のpush URLを生成し、エンドユーザーをリダイレクトします。</p></figcaption></figure>

### シーケンス図

{% stepper %}
{% step %}

#### 対象トークンリクエスタを取得

イシュアアプリケーションはD1 SDKを使用して、指定されたカードに対してToken Connectをサポートするトークンリクエスタの一覧を取得します。

各トークンリクエスタには以下が含まれます:

* 表示名。
* ブランドロゴ。
* 1つ以上の対応するプロビジョニング方法（例: Android、iOS、またはWeb）。

<figure><img src="/files/9e0b62acfb1d651942df670c57c687fb90b58b6d" alt=""><figcaption><p>対象トークンリクエスタを選択するためのイシュアアプリケーションUIの例。</p></figcaption></figure>

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

```kotlin
fun getEligibleTokenRequestors(d1Task: D1Task, cardID: String) {
    val callback: D1Task.Callback<List<TokenRequestor>> = object : D1Task.Callback<List<TokenRequestor>> {

        override fun onSuccess(tkRequestorList: List<TokenRequestor>) {
            // サーバーからの tkRequestorList オブジェクトを処理します。
            // 上のサンプル画像のようにUIに表示する例。
            for (tkRequestor : TokenRequestor in tkRequestorList) {
                val tkRequestorID : String = tkRequestor.id
                val tkRequestorName : String = tkRequestor.name
                val tkRequestorAssets : MutableList<AssetContent>? = tkRequestor.assets // トークンリクエスタのロゴ。
                val tkrProvisioningMethods : MutableList<ProvisioningMethod> = tkRequestor.provisioningMethods // トークンリクエスタのプロビジョニング方法。
            }
        }

        override fun onError(exception: D1Exception) {
            // D1 SDK統合 – エラー管理セクションを参照してください。
        }
    }

    d1Task.getTokenRequestorList(cardID, callback)
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
let cardID = "" // たとえばバックエンドから取得します

d1Task.tokenRequestorList(cardID) { tokenRequestors, error in
    if let error = error {
        // D1 SDK統合のエラー管理セクションを参照してください
    } else if let tokenRequestors = tokenRequestors {
        // tokenRequestorsをUIに表示します
        for tokenRequestor in tokenRequestors {
            print("ID: \(tokenRequestor.id ?? "")")
            print("Name: \(tokenRequestor.name ?? "")")

            if let asset = tokenRequestor.asset?.first,
               let imageData = Data(base64Encoded: asset.encodedData) {
                let image = UIImage(data: imageData)
                _ = image
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}
{% endstep %}

{% step %}

#### カードをトークンリクエスタにプッシュする

エンドユーザーがトークンリクエスタを選択した後、イシュアアプリケーションは **push URL** を呼び出すことで `addDigitalCardToScheme()`.

イシュアアプリケーションは、その後、返されたpush URLを使用してエンドユーザーをトークンリクエスタへリダイレクトします。

<figure><img src="/files/db61f10b1ada058a89df782495c6a7156d674f61" alt=""><figcaption><p>Token Connectプッシュフローを開始するためのイシュアアプリケーションUIの例。</p></figcaption></figure>

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

```kotlin
//cardID: getConsumerDetails APIで受信。
//tokenRequestor: ユーザー選択済み。
fun pushCardToTokenRequestor(d1Task: D1Task, cardID: String, tokenRequestor: TokenRequestor) {
    val appURL = "d1demoapp://com.thalesgroup.gemalto.d1.validation/PushToSchemeResult" // デジタル化フロー完了時にトークンリクエスタがコールバックする、イシュアアプリケーションのカスタムURL。
    val tcsAccepted = true

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

        override fun onSuccess(pushUrl: String) {
            // トークンリクエスタアプリケーションを起動します。
            getActivity().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(pushUrl)))
        }

        override fun onError(exception: D1Exception) {
            // D1 SDK統合 – エラー管理セクションを参照してください。
        }
    }

    // Click to Payでは、Mastercardの tokenRequestor.id 属性値は 50123197928 です。
    d1Task.addDigitalCardToScheme(
        cardID,
        tokenRequestor,
        appURL,
        tcsAccepted,
        callback
    )
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
let cardID = "" // たとえばバックエンドから取得します

// Tokenizationフローの後にトークンリクエスタが呼び出す、イシュアアプリケーションのディープリンクURL。
let appURL = "test://sample.com.demo/tokenRequestorsPage"

// tokenRequestorはエンドユーザーによって選択され、tokenRequestorList()から返されます。

d1Task.addDigitalCardToScheme(
    cardID,
    tokenRequestor: tokenRequestor,
    appURL: appURL,
    termsAndConditionsAccepted: true
) { provisionString, error in
    if let error = error {
        // D1 SDK統合のエラー管理セクションを参照してください
    } else if let provisionString = provisionString,
              let pushUrl = URL(string: provisionString),
              UIApplication.shared.canOpenURL(pushUrl) {
        UIApplication.shared.open(pushUrl)
    }
}
```

{% endtab %}
{% endtabs %}

**次に起こること**

* D1 SDKはpush URLを返します。
* イシュアアプリケーションは、トークンリクエスタアプリケーションまたはWebビューでpush URLを開きます。
* トークンリクエスタはTokenizationフローを実行します。
* フローが完了すると、トークンリクエスタは、 `appURL`.
  {% endstep %}
  {% endstepper %}

{% hint style="info" %}

* 設定するには `appURL`、イシュアアプリケーションでディープリンクを実装してください: [Android](https://developer.android.com/training/app-links/deep-linking), [iOS](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app).
* トークンリクエスタはTokenizationの結果をイシュアアプリケーションに返します。詳細については、Mastercardのガイドを参照してください: [トークンリクエスタからの応答を受信](https://developer.mastercard.com/mdes-token-connect/documentation/tutorials-and-guides/issuer-implementation-guide/#receive-response-from-token-requestor).
  {% endhint %}

{% hint style="warning" %}
Mastercard **簡素化された有効化** はサポートされていません。
{% endhint %}

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-scheme/push-to-token-requestors-token-connect.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.
