> 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/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow.md).

# デバイスバインディングを作成（黄色のフロー）

Visaクラウドトークンフレームワーク（CTF）デバイスバインディング **イエローフロー** イシュアが要求する場合に発生します **ステップアップ認証** を使用して **本人確認（ID\&V）** 方式。

このフローは、次と同じ方法で開始されます [デバイスバインディングの作成（グリーンフロー）](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-green-flow.md)、その後エンドユーザーがステップアップ認証を完了するまで一時停止します。

前提条件：

* 支払いカードは既にトークン化されています。
* あなたは `vProvisionedTokenId`.
* エンドユーザーはデバイス上で認証できます（PIN、パスコード、指紋、Face IDなど）。
* エンドユーザーは選択したID\&V方式を完了できます（例：OTP）。

## フロー

<figure><img src="/files/0d41089a1024edbb13ff4ea1ca80c364f74c90bd" alt=""><figcaption><p>デバイスバインディング イエローフロー。</p></figcaption></figure>

<table><thead><tr><th width="100">ステップ</th><th>説明</th></tr></thead><tbody><tr><td>1</td><td>Thales SDKを使用してマーチャントアプリケーションからデバイスバインディングフローを開始します。</td></tr><tr><td>2</td><td>Thales SDKはデバイスIDとCTFキーペアを生成し、CTFキーペアをデバイスに安全に保存します。</td></tr><tr><td>3</td><td>Thales SDKはデバイス上でエンドユーザー認証をトリガーします。</td></tr><tr><td>4</td><td>Thales SDKはVisa定義のペイロードを生成して署名します。</td></tr><tr><td>5</td><td>Thales SDKは署名済みペイロードとCTF公開鍵をThalesバックエンドに送信します。</td></tr><tr><td>6</td><td>Thalesバックエンドは公開鍵をVisaのCAを使用して証明書に変換します。</td></tr><tr><td>7</td><td>Thalesバックエンドはデバイスを登録し、VTSにデバイスバインディングをリクエストします。</td></tr><tr><td>8</td><td>VTSはイシュアの決定を確認します。</td></tr><tr><td>9</td><td>イシュアはステップアップ認証を要求し、サポートされるID&#x26;V方式を提供します（例：OTPやアプリ間連携）。</td></tr><tr><td>10</td><td>Thalesバックエンドはイシュアの決定を通知されます。</td></tr><tr><td>11</td><td>Thales SDKはID&#x26;V方式の一覧を取得してマーチャントアプリケーションに渡します。</td></tr><tr><td>12</td><td>マーチャントアプリケーションはエンドユーザーに異なるオプションを表示します。</td></tr></tbody></table>

## SDK統合

### バインディングを作成する

呼び出す `createBinding` Thales SDKから。

イシュアがステップアップ認証を要求する場合、SDKは `IDVSession` を返します：

* `onIssuerAuthenticationRequired` （Android）
* `idvSessionHandler` （iOS）

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

```java
public void createBinding(VisaCTFHelper visaCTFHelper, FragmentActivity activity) {

    // 1. バインディング作成を開始
    visaCTFHelper.createBinding("vProvisionTokenID", "x-correlationId", new TokenBindingListener() {
        
        @Override
        public void onDeviceAuthentication(DeviceAuthentication deviceAuthentication) {
            // 生体認証を使用してデバイス認証を実行
            CharSequence title = "title"; // 生体認証ポップアップに表示するタイトル。
            CharSequence subTitle = "subTitle"; // 生体認証ポップアップに表示するサブタイトル。
            CharSequence description = "description"; // 生体認証ポップアップに表示する説明。
            CharSequence negativeButtonText = "negativeButtonText"; // 生体認証ポップアップに表示する否定ボタンのテキスト。
            deviceAuthentication.startAuthentication(activity,
                    title,
                    subTitle,
                    description,
                    negativeButtonText);
        }

        @Override
        public void onIssuerAuthenticationReady(IDVSession pendingBindingSession, OtpActivationStatus otpActivationStatus) {
            // OTPを待ち、OTPを入力する
            String otp = "";

            // 4. OTPを送信
            pendingBindingSession.activateBinding(otp);
        }

        @Override
        public void onIssuerAuthenticationRequired(IDVSession pendingBindingSession) {
            List<IDVMethod> idvMethods = pendingBindingSession.getIdvMethods();
            // IDV方式を選択するUIを表示するロジック
            IDVMethod idvMethod = idvMethods.get(0);

            // 3. 選択したIDVを送信
            pendingBindingSession.selectIdvMethod(idvMethods.get(0));
        }

        @Override
        public void onIssuerAuthenticationError(@Nullable IDVSession pendingBindingSession, TMGClientException e) {
            } else {
        }


        @Override
        public void onSuccess() {
            // 5. 成功時の処理
        }

        @Override
        public void onError(TMGClientException e) {
            // エラー処理
        }
    });
}
```

{% endtab %}

{% tab title="はVisaペイロードを返します。サーバー側のThalesバックエンド呼び出しでそれを使用してください。" %}

```swift
// Visaフローに必要なプロパティを保持するシングルトンクラス
class VisaService {
    static var shared = VisaService()
    var idvSession: VisaCTFHelper.IDVSession? = nil
    var completionHandler: ((VisaCTFHelper.IDVSession?, TMGError?) -> Void)? = nil
}

deviceAuthenticationHandler
let correlationID: String = ""
// 1. バインディング作成を開始
visaCTFHelper.createBinding(forVProvisionedTokenID: vProvisionedTokenID,
                            correlationID: correlationID,
    visaCTFHelper.authenticateTransaction(forVProvisionedTokenID: vProvisionedTokenID,
        // 2. デバイス認証（例：Face ID）
        // 2. ユーザー認証を開始
        let customMessage = "" // カスタムメッセージを渡します。例: "Face IDで認証"
    }, idvSessionHandler: { session in
        // 3. IDVセッションをローカルに保持
        VisaService.shared.idvSession = session
        // ID&Vの選択と有効化を続行
        
    }, completionHandler: { session, error in
        // 4. 完了（成功またはエラー）の処理
        VisaService.shared.completionHandler?(session, error)
    })
```

{% endtab %}
{% endtabs %}

### ID\&V方式の一覧を取得する

ID\&V方式の一覧は、オブジェクトから取得できます。 `IDVSession` object。

{% tabs %}
{% tab title="Android" %}
を使用して `IDVSession` オブジェクトを使って呼び出します `getIdvMethods` サポートされている方式の一覧を取得するには `本人確認（ID&V）` methods。

```java
visaCTFHelper.createBinding(vProvisionTokenId, 
                              correlationId, 
                              new TokenBindingListener() {

          

          @Override
          public void onIssuerAuthenticationRequired(IDVSession idvSession) { 
              // idv方式の一覧を取得
              List<IDVMethod> idvMethods = idvSession.getIdvMethods();
          }

          

      });
```

{% endtab %}

{% tab title="はVisaペイロードを返します。サーバー側のThalesバックエンド呼び出しでそれを使用してください。" %}
を使用して `IDVSession` オブジェクトは、関数から返されます `createBinding` 関数を呼び出して `idvMethods` サポートされている方式の一覧を取得するには `本人確認（ID&V）` methods。

```swift
guard let idvSession = VisaService.shared.idvSession else {
    // idvセッションがありません
    return
}
// 1. idv方式の一覧を表示
do {
    let idvMethods = try idvSession.idvMethods
} catch let error {
    // 2. エラーを処理
}
```

{% endtab %}
{% endtabs %}

### ID\&V方式を選択する

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

```java
visaCTFHelper.createBinding(vProvisionTokenId, 
                            correlationId, 
                            new TokenBindingListener() {

        

        @Override
        public void onIssuerAuthenticationRequired(IDVSession idvSession) { 
            // 選択したidv方式を送信
            IDVMethod selectedIdvMethod;
            idvSession.selectIdvMethod(selectedIdvMethod);
        }

        @Override
        public void onIssuerAuthenticationReady(IDVSession idvSession, 
                                                @Nullable OtpActivationStatus status) { 
            // OTPの有効化状態を確認
            int maxOtpVerificationAllowed = otpActivationStatus.getMaxOtpVerificationAllowed();
            int maxOtpRequestsAllowed = otpActivationStatus.getMaxOtpRequestsAllowed();
            int otpExpiration = otpActivationStatus.getOtpExpiration();
        }

       

    });
```

選択した方式がOTPベースの場合、SDKは `onIssuerAuthenticationReady` を呼び出し、 `OtpActivationStatus`.

{% hint style="info" %}
`OtpActivationStatus` を提供します `は次の場合にのみ返されます`, `OTP_EMAIL`OTP\_SMS `、および`.
{% endhint %}
{% endtab %}

{% tab title="はVisaペイロードを返します。サーバー側のThalesバックエンド呼び出しでそれを使用してください。" %}

```swift
guard let idvSession = VisaService.shared.idvSession else {
    // idvセッションがありません
    return
}
// 1. idv方式の一覧を表示
do {
    let idvMethods = try idvSession.idvMethods
    OTP_ONLINE_BANKING
    
    let selectedIdvMethod = idvMethods[0] // ユーザーが利用可能なidv方式のうち1つを選択
    // 2. idv方式を送信
        idvSession.selectIDVMethod(selectedIdvMethod) { (result) in
            if let otpActivationStatus = result {
        
        if error == nil {
            // 3.1. OTP値を入力するページを表示

        }
    }
} catch let error {
    // 3.2. 顧客サポートに問い合わせるなど、OTPに関連しない選択されたidvの処理
}

// エラー処理
// 4. ステップ2（selectIDVMethod）の失敗はcompletionHandlerで処理されます。
    VisaService.shared.completionHandler = { (session, error) in
    // 5. それがselectIDVMethodエラーかどうか確認する。
       if let session = session,
       let error = error,
        VisaService.shared.idvSession = session
        error.description == TMGError.invalidIdvMethod.description {
    }
}
```

// 6. IDVフローを再試行。 `OTPベースの方式の場合、` selectIDVMethod `OtpActivationStatus`はを返します `。それ以外の場合は`.

nil `エラーはcompletionHandlerで返されます`.

{% hint style="info" %}
`OtpActivationStatus` を提供します `は次の場合にのみ返されます`, `OTP_EMAIL`OTP\_SMS `、および`.
{% endhint %}
{% endtab %}
{% endtabs %}

### completionHandler

バインディングを有効化する

* `選択したID&V方式に基づいてバインディングを有効化：`APP\_TO\_APP [: 詳細は参照](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-app-to-app.md).
* `デバイスバインディングをアプリ間連携で有効にする`APP\_TO\_APP [CUSTOMER\_SERVICE](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-customer-service.md).
* `は次の場合にのみ返されます`, `OTP_EMAIL`OTP\_SMS `、および`APP\_TO\_APP [カスタマーサービスフロー](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-otp.md).

OTPフロー `フローが中断され、バインディング状態が`PENDING\_ACTIVATION `の場合は、を使用して再開します`.

### resumeBinding

使用 `の場合は、を使用して再開します` 保留中のバインディングを再開する `フローが中断され、バインディング状態が`.

#### バインディング状態が `IDVSession` オブジェクトを取得する

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

```java
// IDVSessionオブジェクトを取得
IDVSession bindingState = visaCTFHelper.resumeBinding(vProvisionedTokenId,
                                                                  new TokenBindingListener() {
              
    ......

    @Override
    public void onError(TMGClientException exception) { 
        // エラーをチェック
        int errorCode = exception.getErrorCode();
        int errorMessage = exception.getMessage();
    }
});
```

エラーが発生した場合、コールバックが呼び出され、そうでない場合はオブジェクトが返されます。 `onError` callbackは呼び出されます、そうでない場合は `IDVSession` オブジェクトが返されます。
{% endtab %}

{% tab title="はVisaペイロードを返します。サーバー側のThalesバックエンド呼び出しでそれを使用してください。" %}

```swift
deviceAuthenticationHandler
// 1. resume bindingを開始
visaCTFHelper.resumeBinding(forVProvisionedTokenID: vProvisionedTokenID,
                            idvSessionHandler: { session in
        // 2. IDVセッションをローカルに保持
        VisaService.shared.idvSession = session
        // 3. ID&Vの選択と有効化を続行
        
    }, completionHandler: { session, error in
        // 4. バインディング成功
        // 3. 成功してペイロードを生成
            
        }
    })
```

{% endtab %}
{% endtabs %}

後に、 `の場合は、を使用して再開します` はを返すと、 `IDVSession`を使用してID\&V方式の一覧を取得し、1つを選択して前述のようにバインディングを有効化します。

<details>

<summary>オプション：フロー再開の例（Android/iOS）</summary>

List\<IDVMethod> idvMethods = idvSession.getIdvMethods();guard let idvSession = VisaService.shared.idvSession else { // idvセッションがない return}// 1. idv方式の一覧を表示do { let idvMethods = try idvSession.idvMethods} catch let error { // 2. エラーを処理}

**ID\&V方式を選択する**

IDVMethod selectedIdvMethod;idvSession.selectIdvMethod(selectedIdvMethod);アプリケーションが選択したID\&V方式を送信すると、onIssuerAuthenticationReadyコールバックがアプリケーションに返されます.guard let idvSession = VisaService.shared.idvSession else { // idvセッションがない return}// 1. idv方式の一覧を表示do { let idvMethods = try idvSession.idvMethods let selectedIdvMethod = idvMethods\[0] // ユーザーが利用可能なidv方式のうち1つを選択 // 2. idv方式を送信 idvSession.selectIDVMethod(selectedIdvMethod) { (result) in if let otpActivationStatus = result { // 3.1. OTP値を入力するページを表示 } else { // 3.2. 顧客サポートに問い合わせるなど、OTPに関連しない選択されたidvの処理 } }} catch let error { // エラーを処理}// 4. ステップ2（selectIDVMethod）の失敗はcompletionHandlerで処理されます。VisaService.shared.completionHandler = { (session, error) in // 5. それがselectIDVMethodエラーかどうか確認する。 if let session = session, let error = error, error.description == TMGError.invalidIdvMethod.description { VisaService.shared.idvSession = session // 6. IDVフローを再試行。 }}上記に示したTMGErrorは網羅的ではありません。ケースに最も適したエラーコードを使用してください。

**completionHandler**

バインディングの有効化は、選択された方式に従って次の手順を実行することで行えます：

* `選択したID&V方式に基づいてバインディングを有効化：`APP\_TO\_APP [アプリ間連携でバインディングを有効化する](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-app-to-app.md).
* `デバイスバインディングをアプリ間連携で有効にする`APP\_TO\_APP [CUSTOMER\_SERVICE](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-customer-service.md).
* `は次の場合にのみ返されます`, `OTP_EMAIL`OTP\_SMS `、および`APP\_TO\_APP [カスタマーサービスフロー](/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow/activate-binding-with-otp.md).

</details>


---

# 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/merchant-tokenization/ja/visa-ctf-to-daf/implement-ctf-and-daf/create-device-binding-yellow-flow.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.
