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

> ## Agent Instructions
> Test in the sandbox first: base URL https://api-sandbox.y.uno (Test Mode in the Dashboard). Production is https://api.y.uno (Live Mode).
> Every API request needs the public-api-key and private-secret-key headers. Get them in the Dashboard at https://dashboard.y.uno/developers (Developers > Credentials); sandbox and production keys are different.
> Send an X-Idempotency-Key (a UUID) when creating payments, refunds and cancels, so retries do not create duplicates.
> Start with the Quickstart (https://docs.y.uno/docs/quickstart.md) and the agent guide (https://docs.y.uno/agents.md). To search these docs from a coding agent, connect the docs MCP server at https://docs.y.uno/mcp.

# 卡过滤器和须知事项

> 筛选 Apple Pay 表单中符合条件的卡，从一次性令牌中读取 DPAN BIN，并处理已取消的 Apple Pay 流程。

## 筛选符合条件的卡

创建结账会话时发送 `wallet_card_acceptance`，以限制客户可以在 Apple Pay 支付表单中选择的卡。不匹配的卡会显示为灰色。

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "country": "BR",
  "customer_id": "070a34cb-4649-4a4e-b231-065a53060379",
  "merchant_order_id": "order-123",
  "payment_description": "Apple Pay one-time payment",
  "amount": {
    "currency": "BRL",
    "value": 100
  },
  "wallet_card_acceptance": {
    "supported_countries": ["BR"],
    "supported_networks": ["VISA", "MASTERCARD", "ELO"],
    "supported_funding_types": ["CREDIT"]
  }
}
```

| 字段 | 值 | 作用 |
| - | - | - |
| `supported_countries` | ISO 3166-1 alpha-2 代码 | 只能选择在这些国家/地区发行的卡。该字段按发卡国家/地区筛选，而不是按客户所在位置筛选：`["BR"]` 会将在美国发行的卡显示为灰色。 |
| `supported_networks` | 卡组织，例如 `VISA`、`MASTERCARD`、`AMEX`、`ELO` | 只能选择这些卡组织的卡。该字段会替换默认列表（`AMEX`、`DISCOVER`、`ELECTRON`、`ELO`、`MASTERCARD`、`VISA`、`MAESTRO`）：`["VISA"]` 仅允许 Visa。 |
| `supported_funding_types` | `CREDIT`、`DEBIT` | 只能选择这些资金类型的卡：`["CREDIT"]` 仅允许信用卡，`["DEBIT"]` 仅允许借记卡，`["CREDIT", "DEBIT"]` 则两者都允许。 |

* 每个字段都是可选的。您未发送的字段将保持默认行为。
* 值必须为大写。空列表会被拒绝，并返回 `400 INVALID_PARAMETERS`。
* 该对象只能在创建会话时设置。更新会话不会更改该对象。
* 这些过滤器仅适用于 Apple Pay 支付表单。在卡表单中输入的卡不受影响。

> [!NOTE]
>
> 当客户的卡都不符合条件时，Apple Pay 按钮仍会显示。客户会在支付表单中看到所有卡都显示为灰色。

> [!NOTE]
>
> 如果您的账户设置为仅处理信用卡，则对于 Apple Pay，会话中发送的 `supported_funding_types` 优先。

| 平台 | 最低版本 |
| - | - |
| Web | 1.11.17 |
| iOS | 2.27.0 |

## 在 OTT 响应中获取 DPAN BIN

使用 Apple Pay 完成支付后，iOS SDK 会返回完整的 OTT（One-Time Token）服务响应。在此响应中，`card_data` 对象包含与该 Apple Pay 支付相关的卡信息，其中包括 DPAN BIN（交易中使用的 Device Primary Account Number 的前几位数字）。

商户可以使用此对象获取卡详细信息，例如品牌、类型、发卡机构以及代表 DPAN BIN 的 `iin` 字段。您可以使用这些信息评估基于 BIN 的促销和折扣，以及用于报告。

在 iOS 上，请在您的 `YunoPaymentDelegate` 中实现 `yunoCreatePayment(with:information:)`，而不是 `yunoCreatePayment(with:)`。`information` 字典即为此响应。

> [!NOTE]
>
> **限制**：`iin` 反映的是创建支付时支付表单中选中的默认卡。如果购物者在支付表单中切换了卡，`iin` 可能与最终支付所用的卡不一致。在支付确认之前，请避免将基于 BIN 的促销作为有保证的优惠展示。

### OTT 响应示例（iOS SDK）

以下示例展示了包含 `card_data` 对象及 `iin` 字段的 SDK 响应：

```json theme={"theme":{"light":"github-dark","dark":"github-dark-dimmed"}}
{
  "vault_on_success": false,
  "country": "US",
  "card_data": {
    "category": "CLASSIC",
    "lfd": "8880",
    "fingerprint": null,
    "issuer_name": "BANK",
    "security_code_length": 0,
    "brand": "VISA",
    "issuer_code": null,
    "type": "CREDIT",
    "holder_name": "",
    "country_code": "US",
    "iin": "49411598",
    "number_length": 0
  },
  "vaulted_token": null,
  "installment": null,
  "token": "0ac7f1c8-aba4-4600-b080-f88e9f328c1f",
  "type": "CARD"
}
```

## Apple Pay 取消流程

当用户取消 Apple Pay 流程时，Web SDK 会报告状态 `CANCELED_BY_USER`，iOS SDK 会在 `Yuno.Result` 中报告 `userCancelled`。

### Metadata 和 paymentCreated（Web SDK）

`oldClosePaymentFlow` 方法（以及相关的取消事件）现在包含一个可选的 `metadata` 参数，其中带有 `paymentCreated` 字段。这样，商户可以知道在用户取消流程之前，是否已在 backend 创建了支付。

* **`paymentCreated: true`**：已创建支付（例如在 OTT 创建阶段）。商户应检查支付状态，并视情况触发 `abandonPayment` 调用。
* **`paymentCreated: false`**：取消之前未创建支付。

SDK 会在 `onvalidatemerchant` 阶段自动设置 `paymentCreated = true`，以确保正确跟踪和放弃待处理的支付。

## 相关文档

* [设置和一次性支付](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/apple-pay-sdk-integration.md)
* [定期支付](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/sdk-integration/recurring-payments.md)
* [快捷 checkout](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/sdk-integration/express-checkout.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.