> 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-ios/implement-nfc-wallet/tokenize-a-card/digitize-card/handle-red-flow.md).

# Handle red flow

## Overview

The red flow happens when the issuer backend declines **Tokenization**.

The decline is typically driven by risk rules or program policy.

When this happens, the application must display a decline message to end user.

## Sequence diagram

<figure><img src="https://3694475028-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6bUtiXdSFHu8lmOj8A0X%2Fuploads%2Fl06XhNIfWJ98kuzluzR3%2FSequence%20Diagram%20-%20%20Handle%20the%20red%20flow.svg?alt=media&amp;token=bdd8cf30-b3a6-4cac-9e2a-b68ca3a72214" alt=""><figcaption><p>Red flow: the issuer backend declines Tokenization and the NFC Wallet SDK emits <code>digitizationDeclined</code>.</p></figcaption></figure>

## Integrate SDK

After you [Check card eligibility](/nfc-wallet-sdk-ios/implement-nfc-wallet/tokenize-a-card/check-card-eligibility.md):

1. Call `CardDigitizationService.digitizeCard()`.
2. Listen to `CardDigitizationService.eventStream`.
3. When the NFC Wallet SDK emits `digitizationDeclined`:
   * Stop the digitization flow.
   * Display a decline message.
   * Offer a retry path (optional).

```swift
func digitizeCard(_ termsAndConditions: CardDigitizationService.TermsAndConditions) async throws {
    // Step 1: Initialize the service.
    let cardDigitizationService = CardDigitizationService()
    let fcmToken: String = "FACY6074293608087656831WRF1234" // Example only.

    // Step 2: Start digitization.
    try await cardDigitizationService.digitizeCard(withTNC: termsAndConditions.accept(),
                                                  pushToken: fcmToken,
                                                  language: "en")

    // Step 3: Listen for outcomes.
    for await state in await cardDigitizationService.eventStream {
        switch state {
        case .digitizationDeclined:
            // Red flow: Tokenization declined by the issuer backend.
            // Show a decline message and stop the flow.
            return
        default:
            break
        }
    }
}
```


---

# 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-ios/implement-nfc-wallet/tokenize-a-card/digitize-card/handle-red-flow.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.
