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

# 注册支付方式

> 注册客户所选的支付方式，以便在 checkout 过程中供将来使用

此请求用于为客户注册支付方式。客户选择要注册的支付方式后，您可以利用 Yuno 提供的信息，将其保存在所创建的支付方式对象中，供将来购买使用。

请注意，此请求需要 `X-Idempotency-Key`。请查看[身份验证](https://docs.y.uno/zh-hans/reference/getting-started/authentication.md#idempotency)。

> [!NOTE]
>
> **Webhook**
>
> 我们建议监听 [Webhook](https://docs.y.uno/zh-hans/docs/webhooks/configure-webhooks.md)，以便及时了解您客户已注册支付方式的状态。

如果客户两次注册同一张卡，但有效期或持卡人信息不同，我们会取消注册之前已注册的卡，并保留新卡。

## 可注册的支付方式

以下支付方式可以通过此 endpoint 注册：

| 支付方式 | 类型 |
| - | - |
| **卡** | `CARD` |
| **Nupay** | `NU_PAY_ENROLLMENT` |
| **PayPal** | `PAYPAL_ENROLLMENT` |
| **Daviplata** | `DAVIPLATA_ENROLLMENT` |
| **MercadoPago Wallet** | `WALLET_CONNECT` |
| **dLocal Yape** | `YAPE_ENROLLMENT` |
| **dLocal Smart PIX** | `SMART_PIX` |
| **Astropay** | `ASTROPAY_ENROLLABLE` |
| **Adyen PIX Biométrico** | `PIX_BIOMETRICO` |

> [!NOTE]
>
> **支付方式可用性**
>
> 当您检索可注册的支付方式时，只会返回您已连接、已创建路由并已添加到 checkout 的支付方式。有关注册工作流的更多信息，请参阅[注册支付方式](https://docs.y.uno/zh-hans/docs/payment-features/enrollment/enroll-payment-methods.md)指南。


## OpenAPI

````yaml openapi/zh-hans/payment-methods-checkout/enroll-payment-method-checkout.json POST /customers/sessions/{customer_session}/payment-methods
openapi: 3.1.0
info:
  title: customer-api-register-payment-method
  version: 1.0.2
servers:
  - url: https://api-sandbox.y.uno/v1
    description: Sandbox
  - url: https://api.y.uno/v1
    description: Production (US)
security:
  - sec0: []
    sec1: []
    sec2: []
paths:
  /customers/sessions/{customer_session}/payment-methods:
    post:
      summary: 注册支付方式
      operationId: enroll-payment-method-checkout
      parameters:
        - name: customer_session
          in: path
          description: >-
            使用[创建客户会话](https://docs.y.uno/zh-hans/reference/customer-sessions-enrollment/create-customer-session)
            endpoint 为注册创建的客户会话（UUID，36 个字符）。
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - account_id
                - payment_method_type
                - country
              properties:
                account_id:
                  type: string
                  description: >-
                    账户的唯一标识符。您可以在 [Yuno Dashboard](https://dashboard.y.uno/)
                    上找到此信息（UUID，36 个字符）。
                payment_method_type:
                  type: string
                  description: >-
                    支付方式类型（MAX 255；MIN
                    3；[支付类型列表](/zh-hans/reference/payment-type-list)）。
                  enum:
                    - CARD
                    - MERCADO_PAGO_WALLET
                    - NEQUI
                    - BANCOLOMBIA_TOKENBOX
                    - NU_PAY_ENROLLMENT
                country:
                  type: string
                  description: >-
                    交易的国家/地区代码（MAX 2；MIN 2；[ISO
                    3166-1](/zh-hans/reference/country-reference)）。
                  enum:
                    - AR
                    - BO
                    - BR
                    - CL
                    - CO
                    - CR
                    - EC
                    - SV
                    - GT
                    - HN
                    - MX
                    - NI
                    - PA
                    - PY
                    - PE
                    - US
                    - UY
                account_updater:
                  type: boolean
                  description: >-
                    卡账户更新器（Card Account Updater）的单卡控制。设置为 `false`
                    时，该卡将被排除在卡账户更新器之外，不会收到自动的卡信息更新。省略时，该卡遵循您账户的账户更新器配置。在注册时适用。
                payment_method:
                  type: object
                  description: 支付方式的可选注册选项。
                  properties:
                    network_token:
                      type: boolean
                      description: >-
                        可选。仅限
                        `CARD`。对[网络令牌](/zh-hans/docs/security-and-compliance/network-tokens#choose-per-card)的单卡控制。`false`：Yuno
                        不为该卡配置网络令牌，包括未使用 CVV 注册的卡。`true` 或省略：Yuno
                        照常配置。要求您的组织已针对该卡的卡组织开通网络令牌；未开通时不会配置令牌，且注册不会失败。
                verify:
                  type: object
                  description: >-
                    指示是否通过验证交易来验证该支付。您需要在 CARD 路由中定义服务提供商。默认为
                    false。更多详情请访问[卡验证](/zh-hans/docs/security-and-compliance/card-verification)页面。
                  required:
                    - vault_on_success
                  properties:
                    vault_on_success:
                      type: boolean
                      description: 指示是否通过验证交易来验证该支付。您需要在 CARD 路由中定义服务提供商。默认为 false。
                    currency:
                      type: string
                      description: >-
                        卡验证的货币。完整的货币代码列表请参阅[国家参考](/zh-hans/reference/country-reference)（MAX
                        3；MIN 3；ISO 4217）。
            examples:
              Enroll:
                value:
                  payment_method_type: CARD
                  country: US
                  account_id: '{{account_id}}'
              Enroll with card verification:
                value:
                  account_id: '{{account_id}}'
                  payment_method_type: CARD
                  country: US
                  verify:
                    vault_on_success: true
                    currency: USD
      responses:
        '201':
          description: '201'
          content:
            application/json:
              examples:
                Enroll:
                  value:
                    id: 0395199e-a99c-4a85-acac-6c916f43fa74
                    account_id: 493e9374-510a-4201-9e09-de669d75f256
                    name: Visa Credit Card
                    description: Visa Credit Card
                    type: VISA
                    category: CARD
                    country: US
                    status: READY_TO_ENROLL
                    created_at: '2024-06-06T13:14:18.799434Z'
                    updated_at: '2024-06-06T13:14:18.799437Z'
                    enrollment:
                      session: 6641e30d-ca7a-440f-b97c-24231eac6dab
                      sdk_required_action: false
                    provider:
                      id: YUNO
                      type: YUNO
                      provider_status: null
                    customer_payer:
                      first_name: John
                      last_name: Doe
                      email: john.doe@email.com
                      gender: M
                      date_of_birth: '1990-02-28'
                      document:
                        document_number: '123456789'
                        document_type: SSN
                      phone:
                        number: '1234567890'
                        country_code: '1'
                      billing_address:
                        address_line_1: 123 Main St
                        address_line_2: Apt 4B
                        country: US
                        state: NY
                        city: New York
                        zip_code: '10001'
                    verify:
                      vault_on_success: false
                      payment: null
                    preferred: null
                Enroll with card verification:
                  value:
                    id: 51887489-60d3-45a9-b895-81d3c1c3aec6
                    account_id: 493e9374-510a-4201-9e09-de669d75f256
                    name: Visa Credit Card
                    description: Visa Credit Card
                    type: VISA
                    category: CARD
                    country: US
                    status: READY_TO_ENROLL
                    created_at: '2024-06-06T13:19:57.828087Z'
                    updated_at: '2024-06-06T13:19:57.828089Z'
                    enrollment:
                      session: 238fc319-4a31-4568-be7f-c475e8fbe230
                      sdk_required_action: false
                    provider:
                      id: YUNO
                      type: YUNO
                      provider_status: null
                    customer_payer:
                      first_name: John
                      last_name: Doe
                      email: john.doe@email.com
                      gender: M
                      date_of_birth: '1990-02-28'
                      document:
                        document_number: '123456789'
                        document_type: SSN
                      phone:
                        number: '1234567890'
                        country_code: '1'
                      billing_address:
                        address_line_1: 123 Main St
                        address_line_2: Apt 4B
                        country: US
                        state: NY
                        city: New York
                        zip_code: '10001'
                    verify:
                      vault_on_success: true
                      currency: USD
                      payment: null
                    preferred: null
              schema:
                oneOf:
                  - title: 注册
                    type: object
                    properties:
                      id:
                        type: string
                        example: 0395199e-a99c-4a85-acac-6c916f43fa74
                      account_id:
                        type: string
                        example: 493e9374-510a-4201-9e09-de669d75f256
                      name:
                        type: string
                        example: Visa Credit Card
                      description:
                        type: string
                        example: Visa Credit Card
                      type:
                        type: string
                        example: VISA
                      category:
                        type: string
                        example: CARD
                      country:
                        type: string
                        example: US
                      status:
                        type: string
                        example: READY_TO_ENROLL
                      created_at:
                        type: string
                        example: '2024-06-06T13:14:18.799434Z'
                      updated_at:
                        type: string
                        example: '2024-06-06T13:14:18.799437Z'
                      enrollment:
                        type: object
                        properties:
                          session:
                            type: string
                            example: 6641e30d-ca7a-440f-b97c-24231eac6dab
                          sdk_required_action:
                            type: boolean
                            example: false
                            default: true
                      provider:
                        type: object
                        properties:
                          id:
                            type: string
                            example: YUNO
                          type:
                            type: string
                            example: YUNO
                          provider_status: {}
                      customer_payer:
                        type: object
                        properties:
                          first_name:
                            type: string
                            example: John
                          last_name:
                            type: string
                            example: Doe
                          email:
                            type: string
                            example: john.doe@email.com
                          gender:
                            type: string
                            example: M
                          date_of_birth:
                            type: string
                            example: '1990-02-28'
                          document:
                            type: object
                            properties:
                              document_number:
                                type: string
                                example: '123456789'
                              document_type:
                                type: string
                                example: SSN
                          phone:
                            type: object
                            properties:
                              number:
                                type: string
                                example: '1234567890'
                              country_code:
                                type: string
                                example: '1'
                          billing_address:
                            type: object
                            properties:
                              address_line_1:
                                type: string
                                example: 123 Main St
                              address_line_2:
                                type: string
                                example: Apt 4B
                              country:
                                type: string
                                example: US
                              state:
                                type: string
                                example: NY
                              city:
                                type: string
                                example: New York
                              zip_code:
                                type: string
                                example: '10001'
                      verify:
                        type: object
                        properties:
                          vault_on_success:
                            type: boolean
                            example: false
                            default: true
                          payment: {}
                      preferred: {}
                  - title: 通过卡验证注册
                    type: object
                    properties:
                      id:
                        type: string
                        example: 51887489-60d3-45a9-b895-81d3c1c3aec6
                      account_id:
                        type: string
                        example: 493e9374-510a-4201-9e09-de669d75f256
                      name:
                        type: string
                        example: Visa Credit Card
                      description:
                        type: string
                        example: Visa Credit Card
                      type:
                        type: string
                        example: VISA
                      category:
                        type: string
                        example: CARD
                      country:
                        type: string
                        example: US
                      status:
                        type: string
                        example: READY_TO_ENROLL
                      created_at:
                        type: string
                        example: '2024-06-06T13:19:57.828087Z'
                      updated_at:
                        type: string
                        example: '2024-06-06T13:19:57.828089Z'
                      enrollment:
                        type: object
                        properties:
                          session:
                            type: string
                            example: 238fc319-4a31-4568-be7f-c475e8fbe230
                          sdk_required_action:
                            type: boolean
                            example: false
                            default: true
                      provider:
                        type: object
                        properties:
                          id:
                            type: string
                            example: YUNO
                          type:
                            type: string
                            example: YUNO
                          provider_status: {}
                      customer_payer:
                        type: object
                        properties:
                          first_name:
                            type: string
                            example: John
                          last_name:
                            type: string
                            example: Doe
                          email:
                            type: string
                            example: john.doe@email.com
                          gender:
                            type: string
                            example: M
                          date_of_birth:
                            type: string
                            example: '1990-02-28'
                          document:
                            type: object
                            properties:
                              document_number:
                                type: string
                                example: '123456789'
                              document_type:
                                type: string
                                example: SSN
                          phone:
                            type: object
                            properties:
                              number:
                                type: string
                                example: '1234567890'
                              country_code:
                                type: string
                                example: '1'
                          billing_address:
                            type: object
                            properties:
                              address_line_1:
                                type: string
                                example: 123 Main St
                              address_line_2:
                                type: string
                                example: Apt 4B
                              country:
                                type: string
                                example: US
                              state:
                                type: string
                                example: NY
                              city:
                                type: string
                                example: New York
                              zip_code:
                                type: string
                                example: '10001'
                      verify:
                        type: object
                        properties:
                          vault_on_success:
                            type: boolean
                            example: true
                            default: true
                          currency:
                            type: string
                            example: USD
                          payment: {}
                      preferred: {}
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Bad Request:
                  value:
                    code: INVALID_REQUEST
                    messages:
                      - Invalid request
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_REQUEST
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid request
        '401':
          description: '401'
          content:
            application/json:
              examples:
                Unauthorized:
                  value:
                    code: INVALID_CREDENTIALS
                    messages:
                      - Invalid credentials
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: INVALID_CREDENTIALS
                  messages:
                    type: array
                    items:
                      type: string
                      example: Invalid credentials
        '403':
          description: '403'
          content:
            application/json:
              examples:
                Forbidden:
                  value:
                    code: AUTHORIZATION_REQUIRED
                    messages:
                      - The merchant has no authorization to use this API.
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: AUTHORIZATION_REQUIRED
                  messages:
                    type: array
                    items:
                      type: string
                      example: The merchant has no authorization to use this API.
      deprecated: false
components:
  securitySchemes:
    sec0:
      type: apiKey
      in: header
      name: public-api-key
      x-default: <Your public-api-key>
    sec1:
      type: apiKey
      in: header
      x-default: <Your private-secret-key>
      name: 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.