> 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="/files/0abikHgFHjeea2EMlkk2" 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 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-ios/implement-nfc-wallet/tokenize-a-card/digitize-card/handle-red-flow.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.
