> 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ウォレット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ウォレット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:

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

The question should be specific, self-contained, and written in natural language.
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.
