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