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

# Push to token requestors (Token Connect)

## Push to token requestors (Token Connect)

Use this guide to push a card from the issuer application to a **token requestor** using **Mastercard MDES Token Connect**.

Token requestors can include e-commerce merchants and wallet providers.

For Mastercard product documentation, see [MDES Token Connect overview](https://developer.mastercard.com/mdes-token-connect/documentation/#overview).

### Overview

With Token Connect, the issuer application:

1. Retrieves the list of eligible token requestors for a card.
2. Requests a **push URL** for the selected token requestor.
3. Redirects the End User to the token requestor experience to complete **Tokenization**.

{% hint style="info" %}
**Prerequisites**

* The End User is authenticated in the issuer application.
* The issuer application has initialized the D1 SDK and completed login.
* The consumer and card are registered in D1.
  {% endhint %}

### End-user experience

The diagram below illustrates a representative Token Connect flow. The same pattern applies to any Token Connect-compliant token requestor.

<figure><img src="/files/XxoUPjf8Nv3zPdeSPs4D" alt=""><figcaption><p>End-user experience example for pushing a card to a token requestor using Token Connect.</p></figcaption></figure>

### Flow

#### Retrieve eligible token requestors

<figure><img src="/files/fSbeLjGIBm337StfGLig" alt=""><figcaption><p>Retrieve the eligible token requestors for a card.</p></figcaption></figure>

#### Push to a token requestor

<figure><img src="/files/O2CG2mA1ZD8E3SDbp060" alt=""><figcaption><p>Generate a push URL for the selected token requestor and redirect the End User.</p></figcaption></figure>

### Sequence diagrams

{% stepper %}
{% step %}

#### Get eligible token requestors

The issuer application uses the D1 SDK to retrieve the list of token requestors that support Token Connect for a given card.

Each token requestor includes:

* A display name.
* A brand logo.
* One or more supported provisioning methods (for example, Android, iOS, or web).

<figure><img src="/files/7tBBLpfZ6azbRnnN7V8Z" alt=""><figcaption><p>Example issuer application UI for selecting an eligible token requestor.</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>) {
            // Handles tkRequestorList object from server.
            // Example to display it on the UI as sample image above.
            for (tkRequestor : TokenRequestor in tkRequestorList) {
                val tkRequestorID : String = tkRequestor.id
                val tkRequestorName : String = tkRequestor.name
                val tkRequestorAssets : MutableList<AssetContent>? = tkRequestor.assets // Logo of the Token Requestor.
                val tkrProvisioningMethods : MutableList<ProvisioningMethod> = tkRequestor.provisioningMethods // Provisioning methods of the Token Requestor.
            }
        }

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

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

{% endtab %}

{% tab title="iOS" %}

```swift
let cardID = "" // Obtained, for example, from your backend

d1Task.tokenRequestorList(cardID) { tokenRequestors, error in
    if let error = error {
        // Refer to the D1 SDK integration error management section
    } else if let tokenRequestors = tokenRequestors {
        // Display tokenRequestors in the 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 a card to a token requestor

After the End User selects a token requestor, the issuer application requests a **push URL** by calling `addDigitalCardToScheme()`.

The issuer application then redirects the End User to the token requestor using the returned push URL.

<figure><img src="/files/cvhPhX6afl9dW2goeW6U" alt=""><figcaption><p>Example issuer application UI to start the Token Connect push flow.</p></figcaption></figure>

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

```kotlin
//cardID: Received with getConsumerDetails API.
//tokenRequestor: User selected.
fun pushCardToTokenRequestor(d1Task: D1Task, cardID: String, tokenRequestor: TokenRequestor) {
    val appURL = "d1demoapp://com.thalesgroup.gemalto.d1.validation/PushToSchemeResult" // The issuer app's custom URL that the token requester calls back upon completion of digitization flow.
    val tcsAccepted = true

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

        override fun onSuccess(pushUrl: String) {
            // Launches the token requester application.
            getActivity().startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(pushUrl)))
        }

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

    // For Click to Pay, the Mastercard tokenRequestor.id attribute value is 50123197928.
    d1Task.addDigitalCardToScheme(
        cardID,
        tokenRequestor,
        appURL,
        tcsAccepted,
        callback
    )
}
```

{% endtab %}

{% tab title="iOS" %}

```swift
let cardID = "" // Obtained, for example, from your backend

// The issuer application's deep link URL that the token requestor calls after the Tokenization flow.
let appURL = "test://sample.com.demo/tokenRequestorsPage"

// tokenRequestor is selected by the End User and returned by tokenRequestorList().

d1Task.addDigitalCardToScheme(
    cardID,
    tokenRequestor: tokenRequestor,
    appURL: appURL,
    termsAndConditionsAccepted: true
) { provisionString, error in
    if let error = error {
        // Refer to the D1 SDK integration error management section
    } else if let provisionString = provisionString,
              let pushUrl = URL(string: provisionString),
              UIApplication.shared.canOpenURL(pushUrl) {
        UIApplication.shared.open(pushUrl)
    }
}
```

{% endtab %}
{% endtabs %}

**What happens next**

* The D1 SDK returns a push URL.
* The issuer application opens the push URL in the token requestor application or in a web view.
* The token requestor performs the Tokenization flow.
* When the flow completes, the token requestor redirects the End User back to the issuer application using the `appURL`.
  {% endstep %}
  {% endstepper %}

{% hint style="info" %}

* To configure `appURL`, implement deep links in your issuer application: [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).
* The token requestor returns the Tokenization result to the issuer application. For details, see the Mastercard guide: [Receive response from token requestor](https://developer.mastercard.com/mdes-token-connect/documentation/tutorials-and-guides/issuer-implementation-guide/#receive-response-from-token-requestor).
  {% endhint %}

{% hint style="warning" %}
Mastercard **streamlined activation** is not supported.
{% endhint %}

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-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.
