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

# 搜索支付

> 列出账户在最长 1 天的时间窗口内创建的支付，支持筛选和游标分页。

此请求列出通过 `X-Account-Code` 标头发送的账户的支付。可用它将支付同步到数据仓库或构建管理面板。如需查找单笔支付，请改用[按 ID 检索支付](https://docs.y.uno/zh-hans/reference/payments/retrieve-payment-by-id-v2.md)或[按商户订单 ID 检索支付](https://docs.y.uno/zh-hans/reference/payments/retrieve-payment-by-merchant-order-id.md)。

## 创建时间窗口

`created_at_from` 和 `created_at_to` 是必填的日期时间，采用带时区偏移的 RFC 3339 格式，例如 `2026-11-03T00:00:00Z` 或 `2026-11-03T00:00:00-03:00`。`created_at_from` 包含边界值，`created_at_to` 不包含边界值，因此共享同一边界的连续时间窗口不会重叠。`created_at_to` 必须晚于 `created_at_from`，两者之间的时间窗口最长为 1 天（24 小时）。时间窗口更宽时会返回 `400 DATE_RANGE_TOO_WIDE`。如需覆盖更长的时间段，请按每个 24 小时窗口发送一个请求，例如连续的 UTC 日。

## 筛选条件

所有筛选条件均为可选，并以 AND 组合：

| 参数 | 匹配 |
| - | - |
| `updated_at_from`、`updated_at_to` | 最后更新时间在此范围内的支付（`updated_at_from` 包含边界值，`updated_at_to` 不包含边界值） |
| `status` | 状态为所发送状态中任意一个的支付，以逗号分隔（`status=SUCCEEDED,DECLINED`）或重复发送（`status=SUCCEEDED&status=DECLINED`） |
| `customer_id` | 该客户（UUID）的支付 |
| `country` | 该国家/地区的支付（ISO 3166-1 alpha-2，例如 `US`） |
| `currency` | 使用该币种的支付（ISO 4217，例如 `USD`） |
| `merchant_order_id` | 具有该商户订单 ID 的支付 |

除 `status` 外，每个参数只发送一次。本页未列出的参数或值无效的筛选条件会返回 `400 INVALID_PARAMETERS`。

## 分页

行按 `created_at` 升序排列。`limit` 设置每页大小，范围为 1 到 100，默认为 50。

响应是一个包含三个字段的对象：

| 字段 | 描述 |
| - | - |
| `payments` | 该页的行 |
| `next_cursor` | 下一页的游标，最后一页时为 `null` |
| `has_more` | 存在下一页时为 `true`，最后一页时为 `false` |

要读取下一页，请将 `next_cursor` 值原样作为 `cursor` 发送，并使用与返回该游标的请求相同的 `X-Account-Code` 和筛选条件。持续分页，直到 `has_more` 为 `false`。被修改的游标，或与不同账户或不同筛选条件一起发送的游标，会返回 `400 INVALID_CURSOR`。分页只能向前进行。

## 行

每一行是支付的摘要：`id`、`account_id`、`merchant_order_id`、`description`、`country`、`status`、`sub_status`、`amount.value`、`amount.currency`、`payment_method.type`、`customer_payer.id`、`created_at` 和 `updated_at`。

> [!NOTE]
>
> 行中不包含 `transactions` 数组。通过 `id` 检索支付即可获取完整的支付对象。

## 错误

错误使用 `code` 和 `messages` 响应结构。

| 状态 | 代码 | 原因 |
| - | - | - |
| 400 | `INVALID_PARAMETERS` | 缺少必填参数、参数不受支持或发送了多次，或者值无效：日期不是带时区偏移的 RFC 3339 格式、`created_at_to` 不晚于 `created_at_from`、`status` 未知、`customer_id` 或 `X-Account-Code` 不是 UUID，或者 `limit` 超出 1 到 100 的范围 |
| 400 | `DATE_RANGE_TOO_WIDE` | `created_at_from` 与 `created_at_to` 之间的时间窗口超过 1 天（24 小时） |
| 400 | `INVALID_CURSOR` | 游标被修改，或与返回该游标的请求使用了不同的账户或筛选条件 |
| 400 | `INVALID_ACCOUNT_ID` | `X-Account-Code` 不是您组织下的账户 |


## OpenAPI

````yaml openapi/zh-hans/payments/search-payments.json GET /payments/search
openapi: 3.1.0
info:
  title: payment-api-search-payments
  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: []
paths:
  /payments/search:
    get:
      summary: 搜索支付
      description: >-
        列出在 `X-Account-Code` 中发送的账户下，在最长 1 天的 `created_at`
        时间窗口内创建的支付，支持可选筛选和游标分页。记录按 `created_at` 升序排列。
      operationId: search-payments
      parameters:
        - name: X-Account-Code
          in: header
          description: 要列出其支付的账户。
          required: true
          schema:
            type: string
            format: uuid
        - name: created_at_from
          in: query
          description: >-
            创建时间窗口的开始时间，包含该时刻（带时区偏移的 RFC 3339，例如
            `2026-11-03T00:00:00Z`）。`created_at_from` 与 `created_at_to` 之间的窗口最长为
            1 天（24 小时）。
          required: true
          schema:
            type: string
            format: date-time
        - name: created_at_to
          in: query
          description: >-
            创建时间窗口的结束时间，不包含该时刻（带时区偏移的 RFC 3339）。必须晚于 `created_at_from`，且最多晚 1
            天（24 小时）。
          required: true
          schema:
            type: string
            format: date-time
        - name: updated_at_from
          in: query
          description: 仅包含在此日期和时间或之后最近更新的支付（带时区偏移的 RFC 3339）。
          schema:
            type: string
            format: date-time
        - name: updated_at_to
          in: query
          description: >-
            仅包含在此日期和时间之前最近更新的支付，不包含该时刻（带时区偏移的 RFC 3339）。同时发送两者时，必须晚于
            `updated_at_from`。
          schema:
            type: string
            format: date-time
        - name: status
          in: query
          description: >-
            要匹配的支付状态。可发送以逗号分隔的列表（`status=SUCCEEDED,DECLINED`），或重复该参数（`status=SUCCEEDED&status=DECLINED`）。
          schema:
            type: array
            items:
              type: string
              enum:
                - CREATED
                - READY_TO_PAY
                - PENDING
                - SUCCEEDED
                - VERIFIED
                - DECLINED
                - REJECTED
                - ERROR
                - EXPIRED
                - CANCELED
                - REFUNDED
                - IN_DISPUTE
                - CHARGEBACK
          style: form
          explode: true
        - name: customer_id
          in: query
          description: 仅包含此客户的支付。
          schema:
            type: string
            format: uuid
        - name: country
          in: query
          description: 仅包含此国家/地区的支付（ISO 3166-1 alpha-2）。
          schema:
            type: string
            pattern: ^[A-Z]{2}$
        - name: currency
          in: query
          description: 仅包含此货币的支付（ISO 4217）。
          schema:
            type: string
            pattern: ^[A-Z]{3}$
        - name: merchant_order_id
          in: query
          description: 仅包含此商户订单 ID 的支付。
          schema:
            type: string
        - name: limit
          in: query
          description: 每页的支付数量，范围 1 到 100。
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
        - name: cursor
          in: query
          description: 上一页的 `next_cursor`，保持不变。请将其与返回它的请求所用的相同 `X-Account-Code` 和筛选条件一起发送。
          schema:
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaymentSearchResult'
              examples:
                Page with more results:
                  value:
                    payments:
                      - id: e3f397ed-b7d0-4816-ab75-8457b0a30ec1
                        account_id: 493e9374-510a-4201-9e09-de669d75f256
                        merchant_order_id: '0000022'
                        description: Test payment
                        country: US
                        status: SUCCEEDED
                        sub_status: APPROVED
                        amount:
                          value: 100
                          currency: USD
                        payment_method:
                          type: CARD
                        customer_payer:
                          id: cfae0941-7234-427a-a739-ef4fce966c79
                        created_at: '2026-11-03T10:24:58.900553Z'
                        updated_at: '2026-11-03T10:25:13.447662Z'
                    next_cursor: c2FtcGxlLWN1cnNvcg.c2FtcGxlLXNpZ25hdHVyZQ
                    has_more: true
                Last page:
                  value:
                    payments: []
                    next_cursor: null
                    has_more: false
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                INVALID_PARAMETERS:
                  value:
                    code: INVALID_PARAMETERS
                    messages:
                      - The query parameter 'created_at_from' is required.
                DATE_RANGE_TOO_WIDE:
                  value:
                    code: DATE_RANGE_TOO_WIDE
                    messages:
                      - >-
                        The range between 'created_at_from' and 'created_at_to'
                        must be at most 1 day.
                INVALID_CURSOR:
                  value:
                    code: INVALID_CURSOR
                    messages:
                      - >-
                        The query parameter 'cursor' is invalid or does not
                        match the filters of this search.
                INVALID_ACCOUNT_ID:
                  value:
                    code: INVALID_ACCOUNT_ID
                    messages:
                      - Account id is invalid
      deprecated: false
components:
  schemas:
    PaymentSearchResult:
      type: object
      required:
        - payments
        - next_cursor
        - has_more
      properties:
        payments:
          type: array
          description: 本页的支付，按 `created_at` 升序排列。
          items:
            $ref: '#/components/schemas/PaymentSummary'
        next_cursor:
          type:
            - string
            - 'null'
          description: 下一页的不透明游标。请将其作为 `cursor` 与相同的筛选条件一起发送。最后一页为 `null`。
        has_more:
          type: boolean
          description: 后面还有下一页时为 `true`，最后一页为 `false`。
    Error:
      type: object
      properties:
        code:
          type: string
        messages:
          type: array
          items:
            type: string
    PaymentSummary:
      type: object
      description: 汇总的支付行。它不包含 `transactions` 数组：请通过 `id` 检索支付以获取完整对象。
      properties:
        id:
          type: string
          format: uuid
          description: 支付的唯一标识符。
        account_id:
          type: string
          format: uuid
          description: 拥有该支付的账户的唯一标识符。
        merchant_order_id:
          type:
            - string
            - 'null'
          description: 客户订单的唯一标识符。
        description:
          type:
            - string
            - 'null'
          description: 支付的描述。
        country:
          type:
            - string
            - 'null'
          description: 支付所在的国家/地区（ISO 3166-1 alpha-2）。
        status:
          type:
            - string
            - 'null'
          description: >-
            支付的状态。参见[支付状态](/zh-hans/reference/payments/status-and-response-codes/payment)。
        sub_status:
          type:
            - string
            - 'null'
          description: 支付的子状态。
        amount:
          type: object
          properties:
            value:
              type:
                - number
                - 'null'
              description: 支付的金额。
            currency:
              type:
                - string
                - 'null'
              description: 支付的货币（ISO 4217）。
        payment_method:
          type: object
          properties:
            type:
              type:
                - string
                - 'null'
              description: 支付方式类型，例如 `CARD` 或 `PIX`。
        customer_payer:
          type: object
          properties:
            id:
              type:
                - string
                - 'null'
              description: 客户的唯一标识符（如果该支付有客户）。
        created_at:
          type: string
          format: date-time
          description: 支付创建的日期和时间（ISO 8601）。
        updated_at:
          type: string
          format: date-time
          description: 支付最近一次更新的日期和时间（ISO 8601）。
  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>

````

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