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

# 检索结账会话

> 使用结账会话的唯一标识符检索其详情

此请求使用结账会话的唯一标识符来检索该结账会话。


## OpenAPI

````yaml openapi/zh-hans/checkout-sessions/retrieve-checkout-session.json GET /checkout/sessions/{id}
openapi: 3.1.0
info:
  title: checkout-api
  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: []
paths:
  /checkout/sessions/{id}:
    get:
      summary: 检索结账会话
      operationId: get-checkout-session
      parameters:
        - name: id
          in: path
          description: 结账会话的唯一标识符（UUID，36 个字符）。
          schema:
            type: string
          required: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value:
                    merchant_order_id: '1752072398'
                    country: AR
                    payment_description: Test Cards
                    customer_id: e937e18e-a684-4d7b-a1a1-ab64c10a941d
                    callback_url: >-
                      https://google.com/?checkoutSession=02caeb08-45c0-4670-9736-5bdee1b311f8
                    amount:
                      currency: ARS
                      value: 520
                    created_at: '2025-07-09T14:46:39.515251Z'
                    metadata: null
                    workflow: SDK_CHECKOUT
                    installments:
                      plan_id: null
                      plan: null
                    used: true
                    checkout_id: 6822f80c-684e-41a3-8628-78963d3d60f7
                    checkout_session: 87749bc1-1ce4-47f3-8745-72602bb6bcea
                    recurring_payment:
                      description: Monthly subscription
                      management_url: https://example.com/manage
                      billing_agreement: BA-123
                      regular_billing:
                        label: Monthly
                        amount: 9.99
                        interval_unit: month
                        interval_count: 1
                      trial_billing:
                        label: Free trial
                        amount: 0
                        interval_unit: month
                        interval_count: 1
              schema:
                type: object
                properties:
                  id:
                    type: string
                    description: 结账会话的唯一标识符（最大 64；最小 36）。
                    example: 02caeb08-45c0-4670-9736-5bdee1b311f8
                  merchant_order_id:
                    type: string
                    description: 客户订单的唯一标识符（MAX 255；MIN 3）。
                    example: '1752072398'
                  country:
                    type: string
                    description: 必须处理该交易的国家/地区（最大 2；最小 2；ISO 3166-1）。
                    example: AR
                  payment_description:
                    type: string
                    description: 支付的描述（MAX 255；MIN 3）。
                    example: Test Cards
                  customer_id:
                    type: string
                    description: 客户的唯一标识符（最大 64；最小 36）。
                    example: e937e18e-a684-4d7b-a1a1-ab64c10a941d
                  callback_url:
                    type:
                      - string
                      - 'null'
                    description: 支付完成后将客户重定向到的 URL（最大 526；最小 3）。
                    example: >-
                      https://google.com/?checkoutSession=02caeb08-45c0-4670-9736-5bdee1b311f8
                  amount:
                    type: object
                    description: 指定支付金额对象，包含金额值和币种。
                    properties:
                      currency:
                        type: string
                        description: 用于支付的币种（最大 3；最小 3；ISO 4217）。
                        example: ARS
                      value:
                        type: number
                        description: 支付金额（0.0001 的倍数）。
                        example: 520
                  created_at:
                    type: string
                    description: 结账会话的创建日期和时间（最大 27；最小 27；ISO 8601）。
                    example: '2025-07-09T14:46:39.515251Z'
                  metadata:
                    type:
                      - array
                      - 'null'
                    description: 指定 metadata 对象列表。最多可添加 50 个 metadata 对象。
                    items:
                      type: object
                      properties:
                        key:
                          type: string
                          description: 指定一个 metadata 键。
                          example: age
                        value:
                          type: string
                          description: 指定所定义 metadata 键的值。
                          example: '28'
                  workflow:
                    type: string
                    description: 支付工作流类型，用于指定结账会话的处理方式。
                    example: SDK_CHECKOUT
                  installments:
                    type: object
                    description: 用于发送在 Yuno 中创建的分期付款计划的对象，以便向您的客户展示并让其选择。
                    properties:
                      plan_id:
                        type:
                          - string
                          - 'null'
                        description: 指定在 Yuno 中创建的、要在结账会话中展示给客户的计划 ID（最大 64；最小 64）。
                      plan:
                        type:
                          - array
                          - 'null'
                        description: 随结账会话向客户展示的分期付款期数。
                        items:
                          type: object
                          properties:
                            installment:
                              type: integer
                              description: 购物者可选择的按月分期付款期数。
                              example: 3
                            rate:
                              type: number
                              description: 使用分期付款后，支付服务提供商对交易最终金额收取的费率。
                              example: 1.5
                  used:
                    type: boolean
                    description: 指定结账会话此前是否已被使用。
                    example: true
                  checkout_id:
                    type: string
                    example: 6822f80c-684e-41a3-8628-78963d3d60f7
                  wallet_card_acceptance:
                    type: object
                    description: 创建结账会话时发送的卡接受规则。仅当会话创建时包含该规则时才会返回。
                    properties:
                      supported_countries:
                        type: array
                        description: >-
                          发卡国家/地区，采用 ISO 3166-1 alpha-2
                          代码。这是卡的发卡国家/地区，而不是客户所在位置。
                        items:
                          type: string
                        example:
                          - BR
                      supported_networks:
                        type: array
                        description: >-
                          客户可选择的卡组织。替换默认列表（AMEX、DISCOVER、ELECTRON、ELO、MASTERCARD、VISA、MAESTRO）。
                        items:
                          type: string
                        example:
                          - VISA
                          - MASTERCARD
                      supported_funding_types:
                        type: array
                        description: 客户可选择的资金类型：CREDIT、DEBIT 或两者。
                        items:
                          type: string
                          enum:
                            - CREDIT
                            - DEBIT
                        example:
                          - CREDIT
                  checkout_session:
                    type: string
                    example: 87749bc1-1ce4-47f3-8745-72602bb6bcea
                    description: 结账会话。
                  recurring_payment:
                    type: object
                    properties:
                      description:
                        type: string
                        example: Monthly subscription
                      management_url:
                        type: string
                        example: https://example.com/manage
                      billing_agreement:
                        type: string
                        example: BA-123
                      regular_billing:
                        type: object
                        properties:
                          label:
                            type: string
                            example: Monthly
                          amount:
                            type: number
                            example: 9.99
                          interval_unit:
                            type: string
                            example: month
                          interval_count:
                            type: integer
                            example: 1
                      trial_billing:
                        type: object
                        properties:
                          label:
                            type: string
                            example: Free trial
                          amount:
                            type: number
                            example: 0
                          interval_unit:
                            type: string
                            example: month
                          interval_count:
                            type: integer
                            example: 1
                    description: 定期支付。
                  tax_collection:
                    type: boolean
                    description: 当结账会话在支付前报价并收取税费时为 `true`。
                  external_subscription:
                    type: object
                    description: >-
                      支付已批准后 Yuno 创建的 Stripe Billing 订阅，用于 [Local price and
                      taxes](/zh-hans/docs/payment-features/subscriptions/local-price-and-taxes)
                      中描述的价格和税费流程。请发送 `customer_id` 和 `items`。`id`（现有订阅）不能与
                      `items` 或 `tax_collection` 一起发送。`trial_period_days` 和
                      `metadata` 暂不支持，会被以 `400` 拒绝。
                    properties:
                      provider:
                        type: string
                        enum:
                          - STRIPE_BILLING
                        description: 账单平台。仅支持 `STRIPE_BILLING`，即默认值。
                      customer_id:
                        type: string
                        description: 客户在 Stripe 中的标识符（`cus_...`）。3 到 255 个字符。
                        example: cus_RplXYZ
                      currency:
                        type: string
                        description: 订阅价格的货币。
                        example: USD
                      items:
                        type: array
                        description: 要创建的订阅的价格。
                        items:
                          type: object
                          properties:
                            price:
                              type: string
                              description: Stripe 中的价格标识符（`price_...`）。
                              example: price_1QwAbc
                            quantity:
                              type: integer
                              description: 价格的数量。默认为 `1`。
                              example: 1
                          required:
                            - price
                      id:
                        type: string
                        description: >-
                          现有订阅（`sub_...`），用于代替 `items`。不能与 `tax_collection`
                          一起使用。
        '400':
          description: '400'
          content:
            application/json:
              examples:
                Result:
                  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
      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.