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

# 4. Support manual mode

## Overview

Complete this step if you plan to support the **manual mode** payment experience.

If you do not support manual mode, skip to [Perform CDCVM verification](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/implement-nfc-wallet/make-payment/implement-contactless-payments/5.-perform-cdcvm-verification.md).

## Sequence flow

In this payment experience:

1. The end user unlocks the device.
2. The end user opens your digital wallet application.
3. The end user selects the card to pay.
4. The application prompts the end user to authenticate.
5. The end user performs a tap within the `keyValidityPeriod`.
6. The transaction is performed with the selected payment card.
7. After the payment completes, or the `keyValidityPeriod` expires, NFC Wallet SDK reverts to the default payment card for the next payment.

## SDK integration

Call `PaymentBusinessService.startAuthentication(...)` to start a manual mode transaction.

This call activates the NFC Wallet payment service. NFC Wallet SDK handles the transaction using the standard contactless payment callback flow.

The following callbacks from `ContactlessPaymentServiceListener` will be called in this order:

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

```java
// 01 - Temporarily change the default card to the selected card, if necessary.
DigitalizedCard originalDefault = null;

// Get card selected by the end user.
DigitalizedCard selectedCard = getSelectedCard();

// If selected card is not the default card, take note of the original default card,
// then set the selected card as the default, before proceeding with payment.
if (!isDefault(selectedCard)) {
    originalDefault = getDefaultCard();  // Save the original default card.
    setDefaultCard(selectedCard);        // Set the selected card as the new default.
}

// 02 - Define the listener to handle the contactless payment flow events.
private PaymentServiceListener paymentServiceListener = new ContactlessPaymentServiceListener() {
    @Override
    public void onAuthenticationRequired(PaymentService paymentService,
                                          CHVerificationMethod cvm, long cvmResetTimer) {
        // 04 - Trigger the authentication according to the CDCVM method.
        startInputCvmActivity(cvm);
    }

    @Override
    public void onTransactionCompleted(TransactionContext ctx) {
        // 05a - After successful transaction, revert to the original default card, if necessary.
        setDefaultCard(originalDefault);
    }

    @Override
    public void onError(TransactionContext transactionContext,
                        PaymentServiceErrorCode errorCode, String msg) {
        // 05b - After failed transaction, revert to the original default card, if necessary.
        setDefaultCard(originalDefault);
    }

    @Override
    public void onTransactionStarted() {
    }

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


// 03 - Trigger authentication prior to payment.
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/implement-nfc-wallet/make-payment/implement-contactless-payments/4.-support-manual-mode.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
