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

# 创建 3DS2 设置

> 为服务器到服务器集成注册 3D Secure 2 浏览器和设备数据，并获取用于后续支付的 three_d_secure_setup_id。

注册您的集成已收集的 3D Secure 2 设置数据：持卡人的浏览器环境以及任何预先计算的设备 fingerprint。作为返回，您将获得一个 `three_d_secure_setup_id`，用于在后续的 `POST /v1/payments` 中引用。

> [!NOTE]
>
> **仅适用于服务器到服务器集成**
>
> 如果您运营服务器到服务器（B2B）集成，并在您这一侧通过您自己的 SDK、欺诈筛查服务提供商的采集器或您直接调用的 3DS2 服务器收集 3DS2 设备数据，请使用此 endpoint。
>
> 如果您通过 Yuno Web/Mobile SDK 和结账会话进行集成，则可以完全跳过此 endpoint。SDK 会收集设备数据，并在 checkout 流程中自动注册。

> [!NOTE]
>
> **仅为注册步骤**
>
> 此 endpoint 不会调用发卡机构，不会呈现挑战，也不会绑定到特定的卡。卡和 `three_d_secure_setup_id` 会在支付调用中一起传递。

> [!WARNING]
>
> **设备数据质量很重要**
>
> 支付服务提供商使用 `browser_info` 和 `device_fingerprints` 评估风险，并在提交支付时决定采用无摩擦流程还是挑战。缺失或过时的字段会提高挑战率。请按调用此 endpoint 时在持卡人浏览器中观察到的值原样发送。

> [!NOTE]
>
> **商户如何提供设备数据**
>
> `type` 字段告诉 Yuno 设备数据的收集来源。`MERCHANT_PROVIDED` 是目前唯一支持的值，表示您在您这一侧收集了浏览器环境和设备 fingerprint，并直接传入。Yuno 不会为此 endpoint 运行自己的采集器。如果您需要 Yuno 采集浏览器/设备数据，请改用 [SDK 版本](https://docs.y.uno/zh-hans/docs/payment-features/3ds-standalone.md)。

## 如何使用响应

1. **存储 id**：在您这一侧将 `three_d_secure_setup_id` 与订单关联保存。
2. **在支付中引用它**：在后续的[创建支付](https://docs.y.uno/zh-hans/reference/payments/create-payment.md)中，将其与卡或存储令牌一起放在 `payment_method.detail.card.three_d_secure.three_d_secure_setup_id` 下传递。Yuno 会将已注册的 `browser_info` 和 `device_fingerprints` 附加到其发送给支付服务提供商的请求中。

请注意，此请求需要 `X-Idempotency-Key`。在 24 小时的重放窗口内，相同的键和相同的 payload 会返回原始的设置 id。如需了解更多信息，请查看[身份验证](https://docs.y.uno/zh-hans/reference/getting-started/authentication.md#idempotency)页面。

## 字段规则和边界情况

| 规则 | 行为 |
| - | - |
| `type` 设为 `MERCHANT_PROVIDED` 以外的值 | `400 INVALID_PARAMETERS`。其他值保留供将来使用。 |
| `browser_info.platform` 设为不支持的值 | `400 INVALID_PARAMETERS`。允许的值：`WEB`、`IOS`、`ANDROID`。 |
| 省略 `device_fingerprints` | 接受。对于未预先提供数据的任何服务提供商，Yuno 将跳过设备 fingerprint 补充。 |
| 在您的账户中找不到 `device_fingerprints[*].provider_id` | 该条目会被静默丢弃；设置会使用其余条目继续进行。 |
| `account_id` 不属于该 API 密钥 | 视为授权失败（`403`）。 |


## OpenAPI

````yaml openapi/zh-hans/three-d-secure-setups/create-three-d-secure-setup.json POST /three-d-secure/setups
openapi: 3.1.0
info:
  title: three-d-secure-setups-api
  version: 1.0.0
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
    sec2: []
paths:
  /three-d-secure/setups:
    post:
      summary: 创建 3DS2 设置
      description: >-
        注册您的集成所收集的 3D Secure 2 设置数据，包括持卡人的浏览器环境和任何预先计算的设备 fingerprint，并获得一个
        `three_d_secure_setup_id`，供后续的 `POST /v1/payments` 引用。
      operationId: create-three-d-secure-setup
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
                - type
                - browser_info
              properties:
                account_id:
                  type: string
                  format: uuid
                  description: 拥有此 3DS2 设置的账户 UUID。
                type:
                  type: string
                  description: 设备数据的来源。`MERCHANT_PROVIDED` 表示您在自己一侧收集了浏览器/设备数据，并直接传入。
                  enum:
                    - MERCHANT_PROVIDED
                browser_info:
                  type: object
                  description: 从持卡人会话中获取的浏览器环境。原样转发给 3DS2 服务器，用于风险评分和无感验证决策。
                  required:
                    - user_agent
                    - accept_header
                    - color_depth
                    - screen_height
                    - screen_width
                    - language
                  properties:
                    user_agent:
                      type: string
                      description: 持卡人浏览器的 `navigator.userAgent`。
                    accept_header:
                      type: string
                      description: 浏览器发送的 `Accept` HTTP 标头的值。
                    color_depth:
                      type: string
                      description: '`screen.colorDepth`，例如 `"24"`。'
                    screen_height:
                      type: string
                      description: '`screen.height`，单位为像素。'
                    screen_width:
                      type: string
                      description: '`screen.width`，单位为像素。'
                    language:
                      type: string
                      description: 来自 `navigator.language` 的 BCP-47 语言标签，例如 `"es-CO"`。
                    javascript_enabled:
                      type: boolean
                      description: 是否启用 JavaScript。省略时默认为 `true`。
                    java_enabled:
                      type: boolean
                      description: 是否启用 Java 插件。在现代浏览器上几乎总是 `false`。
                    browser_time_difference:
                      type: string
                      description: >-
                        浏览器相对 UTC 的偏移量，单位为分钟，带符号（例如 UTC-5 为 `"-300"`）。等同于 `new
                        Date().getTimezoneOffset()`。
                    platform:
                      type: string
                      description: 采集数据的渠道。
                      enum:
                        - WEB
                        - IOS
                        - ANDROID
                    accept_content:
                      type: string
                      description: 可选的 `Accept-Encoding` 值（如果您采集了它）。
                    accept_browser:
                      type: string
                      description: 可选的 `Accept-Language` 值（如果您采集了它）。
                device_fingerprints:
                  type: array
                  description: >-
                    您已在自己一侧收集的一个或多个按服务提供商划分的设备 fingerprint。对于您在此处包含的任何
                    `provider_id`，Yuno 都不会再次执行设备采集。
                  items:
                    type: object
                    required:
                      - provider_id
                      - id
                    properties:
                      provider_id:
                        type: string
                        format: uuid
                        description: >-
                          在您的 Yuno 账户中生成此 fingerprint 的欺诈或设备情报连接的 UUID。可以在
                          **Dashboard → Connections** 中找到，或通过 `GET
                          /v1/connections` 获取。
                      id:
                        type: string
                        description: 该服务提供商的采集器返回的 fingerprint 值。
            examples:
              With device fingerprints:
                value:
                  account_id: 11111111-1111-1111-1111-111111111111
                  type: MERCHANT_PROVIDED
                  browser_info:
                    user_agent: >-
                      Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                      AppleWebKit/537.36
                    accept_header: text/html,application/xhtml+xml,application/xml;q=0.9
                    color_depth: '24'
                    screen_height: '1080'
                    screen_width: '1920'
                    language: es-CO
                    javascript_enabled: true
                    java_enabled: false
                    browser_time_difference: '-300'
                    platform: WEB
                  device_fingerprints:
                    - provider_id: f3a8b5d2-9c4e-4a7b-b1f8-2d6c9e0a4f12
                      id: fp_abc123xyz
              Without device fingerprints:
                value:
                  account_id: 11111111-1111-1111-1111-111111111111
                  type: MERCHANT_PROVIDED
                  browser_info:
                    user_agent: >-
                      Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                      AppleWebKit/537.36
                    accept_header: text/html,application/xhtml+xml,application/xml;q=0.9
                    color_depth: '24'
                    screen_height: '1080'
                    screen_width: '1920'
                    language: es-CO
                    javascript_enabled: true
                    java_enabled: false
                    browser_time_difference: '-300'
                    platform: WEB
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                With device fingerprints:
                  value:
                    three_d_secure_setup_id: a17b4f2c-08d1-4e9b-b6c5-9a3e0c7f1b22
                    account_id: 11111111-1111-1111-1111-111111111111
                    type: MERCHANT_PROVIDED
                    browser_info:
                      user_agent: >-
                        Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                        AppleWebKit/537.36
                      accept_header: text/html,application/xhtml+xml,application/xml;q=0.9
                      color_depth: '24'
                      screen_height: '1080'
                      screen_width: '1920'
                      language: es-CO
                      javascript_enabled: true
                      java_enabled: false
                      browser_time_difference: '-300'
                      platform: WEB
                    device_fingerprints:
                      - provider_id: f3a8b5d2-9c4e-4a7b-b1f8-2d6c9e0a4f12
                        id: fp_abc123xyz
              schema:
                type: object
                properties:
                  three_d_secure_setup_id:
                    type: string
                    description: >-
                      3DS2 设置生成的标识符。在后续的 `POST /v1/payments` 中，将其放在
                      `payment_method.detail.card.three_d_secure.three_d_secure_setup_id`
                      下传递。
                    example: a17b4f2c-08d1-4e9b-b6c5-9a3e0c7f1b22
                  account_id:
                    type: string
                    description: 请求中 `account_id` 的回显。
                    example: 11111111-1111-1111-1111-111111111111
                  type:
                    type: string
                    description: 请求中 `type` 的回显。
                    example: MERCHANT_PROVIDED
                  browser_info:
                    type: object
                    description: 请求中 `browser_info` 的回显。
                    properties:
                      user_agent:
                        type: string
                        example: >-
                          Mozilla/5.0 (Windows NT 10.0; Win64; x64)
                          AppleWebKit/537.36
                      accept_header:
                        type: string
                        example: text/html,application/xhtml+xml,application/xml;q=0.9
                      color_depth:
                        type: string
                        example: '24'
                      screen_height:
                        type: string
                        example: '1080'
                      screen_width:
                        type: string
                        example: '1920'
                      language:
                        type: string
                        example: es-CO
                      javascript_enabled:
                        type: boolean
                        example: true
                      java_enabled:
                        type: boolean
                        example: false
                      browser_time_difference:
                        type: string
                        example: '-300'
                      platform:
                        type: string
                        example: WEB
                  device_fingerprints:
                    type: array
                    description: 请求中 `device_fingerprints` 的回显。
                    items:
                      type: object
                      properties:
                        provider_id:
                          type: string
                          example: f3a8b5d2-9c4e-4a7b-b1f8-2d6c9e0a4f12
                        id:
                          type: string
                          example: fp_abc123xyz
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Invalid parameters:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - account_id must be a valid UUIDv4
                    httpCode: 400
                Missing parameters:
                  value:
                    code: MISSING_PARAMETERS
                    messages:
                      - account_id is required
                    httpCode: 400
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_PARAMETERS
                  messages:
                    type: array
                    items:
                      type: string
                      example: account_id must be a valid UUIDv4
                  httpCode:
                    type: integer
                    example: 400
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: NOT_AUTHENTICATED
                    messages:
                      - Missing API credentials
                    httpCode: 401
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: NOT_AUTHENTICATED
                  messages:
                    type: array
                    items:
                      type: string
                      example: Missing API credentials
                  httpCode:
                    type: integer
                    example: 401
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    code: FORBIDDEN
                    messages:
                      - Account inactive or lacks 3DS2 entitlement
                    httpCode: 403
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: FORBIDDEN
                  messages:
                    type: array
                    items:
                      type: string
                      example: Account inactive or lacks 3DS2 entitlement
                  httpCode:
                    type: integer
                    example: 403
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      name: private-secret-key
      x-default: <Your private-secret-key>
    sec2:
      type: apiKey
      in: header
      name: X-Idempotency-Key
      x-default: <Your X-Idempotency-Key>

````

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