> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fluz.app/llms.txt
> Use this file to discover all available pages before exploring further.

# 測試 KYC 流程

Fluz 要求使用者通過 KYC 驗證後，才能執行特定交易或解鎖更高的限額。在**staging** 環境中，您可以使用已知的測試身分執行完整的驗證流程，並確認您的整合能處理所有結果——而不需使用真實個人資訊。

完整的 mutation 合約與回應參考，請見 [使用者 KYC 驗證](/user-kyc-verification)。

<Note>
  **僅限 Staging**

  本頁身分僅存在於 staging 端點（`https://transactional-graph.staging.fluzapp.com/api/v1/graphql`）。它們是合成資料，無法在正式環境驗證。切勿在 staging 提交真實姓名、地址、出生日期或 SSN。
</Note>

<Info>
  **開始前您需要：** 具備**開發者存取權**的 Fluz 帳號與一個已啟用的應用程式（[準備您的帳號](/get-started/prepare-accounts)），以及要驗證之使用者的**使用者存取權杖**（[產生使用者存取權杖](/recipes/generate-user-access-token)）。該權杖用於識別驗證所屬的 staging 使用者。
</Info>

## 步驟 1 — 建立測試使用者（選擇性）

如果您尚未有可驗證的 staging 使用者，請使用 [`registerUser`](/user-registration) mutation 建立，然後為其產生使用者存取權杖。

<Note>
  **受限的存取**

  `registerUser` 需要 Fluz 的特殊許可。若您的應用程式無法註冊使用者，請改用既有的 staging 使用者。聯絡您的客戶經理或寄信至 [partnerships@fluz.app](mailto:partnerships@fluz.app) 以啟用此功能。
</Note>

## 步驟 2 — 使用可核准的測試身分

以下身分已設定為在 staging 回傳 **APPROVED** 結果。請完全照此提交。

| 欄位   | 值                      |
| ---- | ---------------------- |
| 名    | John                   |
| 姓    | Smith                  |
| 街道地址 | 222333 Peachtree Place |
| 城市   | Atlanta                |
| 州    | GA                     |
| 郵遞區號 | 30318                  |
| 出生日期 | 02/28/1975             |
| SSN  | 112-22-3333            |

<Note>
  API 只會接收 SSN 的**後四碼**（`ssnLast4`）。此身分為 `3333`。出生日期格式為 `MM/DD/YYYY`。
</Note>

## 步驟 3 — 執行驗證

使用核准的身分呼叫 `verifyUserInformation`。將 `<USER_ACCESS_TOKEN>` 替換為欲驗證之使用者的權杖。

<CodeGroup>
  ```curl cURL theme={null}
  curl -X POST https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer <USER_ACCESS_TOKEN>" \
    -d '{
      "query": "mutation VerifyUserInformation { verifyUserInformation(input: { firstName: \"John\", lastName: \"Smith\", streetLine1: \"222333 Peachtree Place\", streetLine2: \"\", city: \"Atlanta\", state: \"GA\", postalCode: \"30318\", country: \"United States\", dateOfBirth: \"02/28/1975\", ssnLast4: \"3333\" }) { status message } }"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://transactional-graph.staging.fluzapp.com/api/v1/graphql",
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Authorization: `Bearer ${accessToken}`,
      },
      body: JSON.stringify({
        query: `
          mutation VerifyUserInformation($input: VerifyUserInformationInput!) {
            verifyUserInformation(input: $input) {
              status
              message
            }
          }
        `,
        variables: {
          input: {
            firstName: "John",
            lastName: "Smith",
            streetLine1: "222333 Peachtree Place",
            streetLine2: "",
            city: "Atlanta",
            state: "GA",
            postalCode: "30318",
            country: "United States",
            dateOfBirth: "02/28/1975",
            ssnLast4: "3333",
          },
        },
      }),
    }
  );

  const data = await response.json();
  console.log(data.data.verifyUserInformation);
  ```
</CodeGroup>

```json Approved response theme={null}
{
  "status": "APPROVED",
  "message": "User verification successful"
}
```

## 步驟 4 — 模擬其他結果

使用相同的 mutation 來測試您對各種驗證狀態的處理。

| 狀態        | 在 staging 的觸發方式                                  |
| --------- | ------------------------------------------------ |
| APPROVED  | 送出上方的可核准測試身分。                                    |
| DECLINED  | 送出與任一已知良好 staging 紀錄不相符的身分。測試值：`[TBD: confirm]`。 |
| DUPLICATE | 重新送出與已通過驗證之 staging 使用者相符的身分資料。                  |
| ERROR     | 針對同一使用者送出第 4 次驗證——驗證次數上限為 3 次。                   |

<Warning>
  在 staging 強制 `DECLINED` 結果的精確欄位值尚未公布。在將其納入自動化測試套件前，請與平台團隊確認。
</Warning>

## 驗證回應

| 狀態        | 訊息                               | 說明                         |
| --------- | -------------------------------- | -------------------------- |
| APPROVED  | User verification successful     | 使用者已通過 KYC 驗證              |
| DECLINED  | Verification declined            | 使用者未通過 KYC 驗證              |
| DUPLICATE | Duplicate user verification      | 使用者已通過 KYC 驗證，但資料與另一位使用者相符 |
| ERROR     | Exceeded user verification limit | 驗證嘗試次數超過 3 次上限             |

## 備註

* **三次嘗試上限。** 同一使用者最多可提交驗證 3 次，超過即回傳 `ERROR`。請規劃測試，避免在仍需使用的使用者上耗盡嘗試次數。
* **權杖為使用者層級。** 存取權杖決定要驗證的是哪位使用者——請確認它屬於您提交身分資料的那位測試使用者。

## 後續步驟

<CardGroup cols={2}>
  <Card title="測試商家" icon="store" href="/test-merchants">
    在 staging 提供可預期優惠、用於演練禮品卡購買的商家。
  </Card>

  <Card title="使用者 KYC 驗證" icon="id-card" href="/user-kyc-verification">
    完整的 mutation 合約——文件驗證連結、狀態與回應。
  </Card>
</CardGroup>
