> 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/authenticate-a-transaction.md).

# トランザクションを認証する

デバイスがバインドされると、Visa Cloud Token Framework（CTF）とDigital Authentication Framework（DAF）を使用して、カード非提示取引を認証できます。

## フロー

<figure><img src="/files/4101133f799198345374c31961d524966ca2719c" alt=""><figcaption><p>CTFおよびDAFの取引認証フロー。</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はVisa定義のペイロードを生成します。</td></tr><tr><td>3</td><td>加盟店またはPSPが、Thalesバックエンドを次の情報を使って呼び出します: <code>tokenId</code>、Visaペイロード、および取引詳細。</td></tr><tr><td>4</td><td>ThalesバックエンドはVTS（Visa TSP）からトークン詳細とクリプトグラムを要求します。</td></tr><tr><td>5</td><td>Thalesバックエンドは次を返します: <code>transactionId</code>、トークン詳細、およびTAF/CTFクリプトグラム。</td></tr><tr><td>6-10</td><td>加盟店またはPSPがオーソリゼーション要求を作成し、アクワイアラーに送信して支払いを完了します。</td></tr></tbody></table>

## SDK統合

### 取引を認証する

呼び出し `authenticateTransaction` の `VisaCTFHelper`.

この呼び出しにはエンドユーザーの存在が必要です。デバイス上での認証を開始します。

{% tabs %}
{% tab title="Android" %}
取引の認証にはエンドユーザーの存在が必要です。これを行うには、次を呼び出します: `startAuthentication` デバイス上での認証を開始します。

この関数は次の場所にあります: `DeviceAuthentication` のオブジェクト内 `onDeviceAuthentication` の一部であるコールバック `TransactionListener`.

UIに表示する生体認証用のカスタム文字列をいくつか渡すことができます。 `startAuthentication` 生体認証のUI表示用の関数に。

```java
visaCTFHelper.authenticateTransaction(vProvisionedTokenId,
                                        new TransactionListener() {
                @Override
                public void onDeviceAuthentication(DeviceAuthentication deviceAuthentication) {
                    FragmentActivity fragmentActivity;
                    CharSequence title;
                    CharSequence subTitle;
                    CharSequence description;
                    CharSequence negativeButtonText;
                    deviceAuthentication.startAuthentication(fragmentActivity, 
                                                            title, 
                                                            subTitle, 
                                                            description, 
                                                            negativeButtonText);
                }

                @Override
                public void onError(TMGClientException exception) {
                    // エラーを確認
                    int errorCode = exception.getErrorCode();
                    int errorMessage = exception.getMessage();
                }

                @Override
                public void onSuccess(String visaPayload) {
                    // Visaペイロードを取得
                }
            });
```

SDKは結果を `onSuccess` または `onError`.

成功すると、 `onSuccess` Visaペイロードを返します。Thalesバックエンドへのサーバーサイド呼び出しで使用します。
{% endtab %}

{% tab title="iOS" %}
取引の認証にはエンドユーザーの存在が必要です。これを行うには、次を呼び出します: `startAuthentication` デバイス上での認証を開始します。

この関数は次の場所にあります: `DeviceAuthentication` のオブジェクト内 `deviceAuthenticationHandler` の一部であるコールバック `authenticateTransaction`.

```swift
let vProvisionedTokenID: String = ""
            
// 1. 取引認証を開始
visaCTFHelper.authenticateTransaction(forVProvisionedTokenID: vProvisionedTokenID,
                                      deviceAuthenticationHandler: { auth in
        // 2. ユーザー認証を開始
        let customMessage = "" // カスタムメッセージを渡します。例: "Face IDで認証してください"
        auth.startAuthentication(withMessage: customMessage)
    }, completionHandler: { (visaPayload, error) in
        // 3. 成功時にペイロードを生成
        if error == nil {
            
        } else {
            // エラーを処理
        }
})
```

{% endtab %}
{% endtabs %}

## API

他の取引フローと同じThalesバックエンド操作を使用します。

* APIリファレンス: [取引を作成](broken://pages/aa59e31deefcb7087369eeed5322fc0609c32f30#post-v2-transactions)


---

# 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/authenticate-a-transaction.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.
