> ## 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.

# 设置虚拟卡 PIN

`setVirtualCardPIN` 变更用于为尚未设置 PIN、且支持 PIN 的虚拟卡设置 PIN。通过 Fluz API 创建虚拟卡时，默认不会设置 PIN。多数情况下你并不需要它。不过，如果你希望设置，可以使用此变更自动识别并更新所有支持 PIN 但尚未设置 PIN 的卡片。

<Info>
  **前提条件：** 具有 `CREATE_VIRTUALCARD` 范围的用户访问令牌。你设置的 PIN 必须与用户 PIN 匹配。
</Info>

<Note>
  此变更会将符合条件的卡片加入待处理队列。实际更新 PIN 可能需要数分钟——响应仅表示入队是否成功，并不表示每张卡都已更新完成。
</Note>

## 参数

* **`input`** (`SetVirtualCardPINInput!`)：包含要在卡片上设置的 PIN 的输入对象。必须与用户 PIN 匹配。

## 示例变更

```graphql theme={null}
mutation {
  setVirtualCardPIN(input: { pin: "1234" }) {
    success
    pinError
  }
}
```

## cURL 示例

```curl theme={null}
curl -X POST \
  https://transactional-graph.staging.fluzapp.com/api/v1/graphql \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_USER_ACCESS_TOKEN' \
  -d '{
    "query": "mutation { setVirtualCardPIN(input: { pin: \"1234\" }) { success pinError } }"
  }'
```

## 示例响应

```json theme={null}
{
  "data": {
    "setVirtualCardPIN": {
      "success": true,
      "pinError": null
    }
  }
}
```

## 响应字段

| 字段         | 类型        | 描述                      |
| ---------- | --------- | ----------------------- |
| `success`  | `Boolean` | 指示设置 PIN 请求是否已成功加入处理队列。 |
| `pinError` | `String`  | 当验证你的 PIN 出错时返回的提示文本。   |

## 代码示例

<Recipe slug="set-virtual-card-pin" title="设置虚拟卡 PIN" />

## 后续步骤

<Card title="数字钱包快速开卡" icon="smartphone" horizontal href="/digital-wallet-push-provisioning">
  将虚拟卡推送到 Apple Pay 或 Google Wallet 以便轻触支付。
</Card>

<StickyContactSalesBanner />
