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

# レッドフローを処理する

## 概要

イシュアのバックエンドが拒否するときに、赤のフローが発生します **トークン化**.

この拒否は通常、リスクルールまたはプログラムポリシーによって発生します。

この場合、アプリケーションはエンドユーザーに拒否メッセージを表示しなければなりません。

## シーケンス図

<figure><img src="/files/4f4c147c89ed86d57e7deaa1d7c494dc7269b80e" alt=""><figcaption><p>赤のフロー: イシュアのバックエンドがトークナイゼーションを拒否し、NFC Wallet SDK が送出します <code>digitizationDeclined</code>.</p></figcaption></figure>

## SDK を統合する

その後 [カードの有効性を確認する](/nfc-wallet-sdk-ios/ja/implement-nfc-wallet/tokenize-a-card/check-card-eligibility.md):

1. 次を呼び出します `CardDigitizationService.digitizeCard()`.
2. 〜を監視する `CardDigitizationService.eventStream`.
3. NFC Wallet SDK が送出するとき `digitizationDeclined`:
   * デジタル化フローを停止します。
   * 拒否メッセージを表示します。
   * 再試行のパスを提供します（任意）。

```swift
func digitizeCard(_ termsAndConditions: CardDigitizationService.TermsAndConditions) async throws {
    // ステップ 1: サービスを初期化します。
    let cardDigitizationService = CardDigitizationService()
    let fcmToken: String = "FACY6074293608087656831WRF1234" // 例のみ。

    // ステップ 2: デジタル化を開始します。
    try await cardDigitizationService.digitizeCard(withTNC: termsAndConditions.accept(),
                                                  pushToken: fcmToken,
                                                  language: "en")

    // ステップ 3: 結果を監視します。
    for await state in await cardDigitizationService.eventStream {
        switch state {
        case .digitizationDeclined:
            // 赤のフロー: トークナイゼーションはイシュアのバックエンドによって拒否されました。
            // 拒否メッセージを表示し、フローを停止します。
            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/ja/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.
