> 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/nfc-wallet-sdk-android/ja/implement-nfc-wallet/make-payment/implement-contactless-payments/4.-support-manual-mode.md).

# 4. 手動モードをサポートする

## 概要

マニュアルモードをサポートする予定がある場合は、この手順を完了してください。 **マニュアルモード** 支払い体験。

マニュアルモードをサポートしない場合は、次に進んでください： [CDCVM 検証を実行する](/nfc-wallet-sdk-android/ja/implement-nfc-wallet/make-payment/implement-contactless-payments/5.-perform-cdcvm-verification.md).

## シーケンスフロー

この支払い体験では：

1. エンドユーザーがデバイスのロックを解除します。
2. エンドユーザーがあなたのデジタルウォレットアプリケーションを開きます。
3. エンドユーザーが支払うカードを選択します。
4. アプリケーションがエンドユーザーに認証を促します。
5. エンドユーザーが `keyValidityPeriod`.
6. の間にタップを行います。
7. 支払いが完了した後、または `keyValidityPeriod` が期限切れになると、NFC Wallet SDK は次回の支払いのためにデフォルトの支払いカードに戻ります。

## SDK の統合

呼び出す `PaymentBusinessService.startAuthentication(...)` マニュアルモードのトランザクションを開始するために。

この呼び出しは NFC Wallet の支払いサービスをアクティブ化します。NFC Wallet SDK は標準の非接触支払いコールバックフローを使用してトランザクションを処理します。

次のコールバックが `ContactlessPaymentServiceListener` からこの順序で呼び出されます：

1. `onTransactionStarted`
2. `onAuthenticationRequired`
3. `onReadyToTap`
4. `onTransactionCompleted`

```java
// 01 - 必要に応じて、選択されたカードに一時的にデフォルトカードを変更します。
DigitalizedCard originalDefault = null;

// エンドユーザーが選択したカードを取得します。
DigitalizedCard selectedCard = getSelectedCard();

// 選択されたカードがデフォルトカードでない場合は、元のデフォルトカードを記録し、
// 支払いを進める前に選択されたカードをデフォルトに設定します。
if (!isDefault(selectedCard)) {
    originalDefault = getDefaultCard();  // 元のデフォルトカードを保存します。
    setDefaultCard(selectedCard);        // 選択されたカードを新しいデフォルトとして設定します。
}

// 02 - 非接触支払いフローのイベントを処理するリスナーを定義します。
private PaymentServiceListener paymentServiceListener = new ContactlessPaymentServiceListener() {
    @Override
    public void onAuthenticationRequired(PaymentService paymentService,
                                          CHVerificationMethod cvm, long cvmResetTimer) {
        // 04 - CDCVM 方法に従って認証をトリガーします。
        startInputCvmActivity(cvm);
    }

    @Override
    public void onTransactionCompleted(TransactionContext ctx) {
        // 05a - トランザクションが成功した後、必要に応じて元のデフォルトカードに戻します。
        setDefaultCard(originalDefault);
    }

    @Override
    public void onError(TransactionContext transactionContext,
                        PaymentServiceErrorCode errorCode, String msg) {
        // 05b - トランザクションが失敗した後、必要に応じて元のデフォルトカードに戻します。
        setDefaultCard(originalDefault);
    }

    @Override
    public void onTransactionStarted() {
    }

    @Override
    public void onReadyToTap(PaymentService service) {
    }
};


// 03 - 支払い前に認証をトリガーします。
final PaymentBusinessService paymentBusinessService = PaymentBusinessManager.getPaymentBusinessService();
paymentBusinessService.startAuthentication(paymentServiceListener, PaymentType.CONTACTLESS);

```


---

# 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/nfc-wallet-sdk-android/ja/implement-nfc-wallet/make-payment/implement-contactless-payments/4.-support-manual-mode.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.
