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

# 结账会话对象

> 介绍结账会话对象及其属性，包括金额、国家/地区和分期付款

此对象表示一个可创建用于进行支付的结账会话。您可以使用创建客户资源时生成的 id 来创建结账会话。

> [!NOTE]
>
> 仅 **SDK\_CHECKOUT** 流程需要创建结账会话。\
> 每个结账会话仅支持一笔支付。
> 结账会话在创建后 2.5 小时过期（sandbox 环境为 3.5 小时）。该有效期无法通过 API 更改，更新结账会话也不会延长有效期。

## 属性

**checkout\_session** `string`

结账会话的唯一标识符（MAX 64; MIN 36）。

示例：9104911d-5df9-429e-8488-ad41abea1a4b

**customer\_id** `string`

客户的唯一标识符（MAX 64; MIN 36）。

示例：9104911d-5df9-429e-8488-ad41abea1a4b

**merchant\_order\_id** `string`

客户订单的唯一标识符（MAX 255; MIN 3）。

示例：1234

**payment\_description** `string`

支付的描述（MAX 255; MIN 3）。

示例：Purchase in Pepito market

**callback\_url** `string`

支付完成后用于重定向客户的 URL（MAX 526; MIN 3）。

示例：[https://www.company.com/customer\_1231324](https://www.company.com/customer_1231324)

**country** `enum`

必须处理该交易的国家/地区（MAX 2; MIN 2; [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1)）。

可能的枚举值：请查看[国家/地区参考](https://docs.y.uno/zh-hans/reference/country-reference.md)。

**created\_at** `timestamp`

结账会话的创建日期和时间（MAX 27; MIN 27; [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)）。

示例：2022-05-09T20:46:54.786342Z

**amount** `object`

指定支付金额对象，包含金额值和币种。

**属性**

**currency** `enum`

支付所使用的币种（MAX 3; MIN 3; [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)）。

可能的枚举值：请查看[国家/地区参考](https://docs.y.uno/zh-hans/reference/country-reference.md)。

**value** `float`

支付金额（0.0001 的倍数）。

示例：23.5676

**metadata** `array of objects`

指定 metadata 对象列表。最多可以添加 50 个 metadata 对象。当路由规则包含 metadata 条件时，此 metadata 决定会话列出哪些支付方式和分期付款。支付路由不会读取它：请同时在支付或客户上设置 metadata。

**属性**

**metadata object** `object`

指定一个 metadata 键及其对应的值。

**属性**

**key** `string`

指定一个 metadata 键（MAX 48）。

示例：age

**value** `string`

指定所定义的 metadata 键对应的值（MAX 512）。

示例：28

**installments** `array of objects`

\[可选] 用于发送在 Yuno 中创建的分期付款方案的对象，以便向客户展示并供其选择。如果会话中需要使用特定的分期付款方案，则使用此可选字段。如果未发送，则在每种场景下显示为该账户创建的分期付款方案（如有）。

**属性**

**plan\_id** `string`

指定在 Yuno 中创建的方案 id，用于在结账会话中向您的客户展示。如果未定义，则使用为该账户创建的方案（如适用）（MAX 64; MIN 64）。

**plan** `array of objects`

在 checkout\_session 中向客户展示的分期付款。如果会话中需要使用特定的分期付款方案，但尚未为其创建分期付款方案，则使用此可选结构。

**属性**

**installment object** `object`

指定结账会话中可用的一个分期付款选项。

**属性**

**installment** `int`

购物者可以选择的按月分期期数

示例：3

**rate** `float`

最终用户在 checkout 时看到的费率。

示例：1.5

**tax\_collection** `boolean`

当结账会话在支付之前按客户地址报价并收取税费时为 `true`。请参阅 [本地价格和税费](https://docs.y.uno/zh-hans/docs/payment-features/subscriptions/local-price-and-taxes.md)。

**external\_subscription** `object`

支付已批准后 Yuno 创建的 Stripe Billing 订阅。如果创建会话时未包含该对象，则不会出现。

**属性**

**provider** `string`

账单平台。

示例：STRIPE\_BILLING

**customer\_id** `string`

客户在 Stripe 中的标识符。

示例：cus\_RplXYZ

**currency** `string`

订阅价格的币种。

示例：USD

**items** `array of objects`

订阅的价格。每个项目包含 `price` 和 `quantity`。

示例：price\_1QwAbc, quantity 1

**id** `string`

现有的订阅，在发送它而非 `items` 时使用。

**wallet\_card\_acceptance** `object`

\[可选] 限制客户可以在 Apple Pay 支付表单中选择哪些卡片。不匹配的卡片会显示为灰色。所有字段都是可选的；未发送的字段保持默认行为。只能在创建结账会话时设置。请参阅 [筛选符合条件的卡片](https://docs.y.uno/zh-hans/docs/wallets/apple-pay/sdk-integration/card-filters-and-good-to-know.md#filter-eligible-cards)。

**属性**

**supported\_countries** `array of strings`

发行该卡片的国家/地区（[ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) alpha-2，大写）。这是卡片的发行国家/地区，而不是客户所在的位置。

示例：\["BR"]

**supported\_networks** `array of strings`

客户可以选择的卡组织，使用大写。替换默认列表。

示例：\["VISA", "MASTERCARD"]

**supported\_funding\_types** `array of enum`

客户可以选择的资金类型。

可能的枚举值：`CREDIT`、`DEBIT`。


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