> ## Documentation Index
> Fetch the complete documentation index at: https://docs.subotiz.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 业务对象

交易单（Trade）业务对象字段说明

| 属性名                     | 类型                 | 描述                                                                                                                                                                                        |
| ----------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| trade\_id               | string             | 交易单ID                                                                                                                                                                                     |
| access\_no              | string             | 接入方编号                                                                                                                                                                                     |
| merchant\_id            | string             | 商户ID                                                                                                                                                                                      |
| amount                  | string             | 支付金额，截取两位小数                                                                                                                                                                               |
| currency                | string             | 币种                                                                                                                                                                                        |
| customer\_id            | string             | 平台顾客 ID                                                                                                                                                                                   |
| callback\_url           | string             | webhook 通知回调地址                                                                                                                                                                            |
| metadata                | map\[string]string | 一组可附加到对象上的键值对，允许您以结构化格式存储附加信息。                                                                                                                                                            |
| last\_payment\_error    | LastPaymentError   | 最后一次支付错误信息，如果该字段有值，则表示支付失败。                                                                                                                                                               |
| next\_action            | NextAction         | 下一步操作                                                                                                                                                                                     |
| order\_id               | string             | 接入方订单号                                                                                                                                                                                    |
| last\_trans\_id         | string             | 订单流水ID。                                                                                                                                                                                   |
| paid\_at                | string             | 支付成功时间                                                                                                                                                                                    |
| payment\_mode           | string             | 支付业务模式：<br />subscription：首次订阅支付，需要收集顾客支付信息，传入 payment\_method\_data 字段，支付成功时会返回 payment\_token 用于后续订阅续费<br />recurring\_payment：订阅续订支付，需要传入 payment\_token 完成支付，无需收集用户支付信息               |
| payment\_token          | string             | 订阅支付时，返回的支付凭证，用于后续订阅续费                                                                                                                                                                    |
| payment\_method         | string             | 支付方式                                                                                                                                                                                      |
| payment\_channel        | string             | 支付渠道                                                                                                                                                                                      |
| return\_url             | string             | 在类似 3DS 跳转支付场景时，支付渠道受理成功后重定向的页面                                                                                                                                                           |
| trade\_status           | string             | 支付单状态：<br />requires\_payment\_method：初始状态<br />payment\_failed：支付失败<br />processing：支付处理中<br />succeeded：支付成功<br />closed：已关闭                                                            |
| txn\_time               | string             | 交易发起时间，客户端发起接口的时间                                                                                                                                                                         |
| created\_at             | string             | 创建时间                                                                                                                                                                                      |
| refund\_status          | string             | 退款状态：<br />no\_refund：无退款<br />partially\_refunded：部分退款<br />refunded：退款完成                                                                                                                |
| total\_refunded\_amount | string             | 退款金额，截取两位小数                                                                                                                                                                               |
| session\_id             | string             | Session 唯一标识                                                                                                                                                                              |
| session\_url            | string             | Session 的访问地址                                                                                                                                                                             |
| refer\_info             | ReferInfo          | 顾客的来源信息                                                                                                                                                                                   |
| order\_type             | string             | 在不同采购或计费场景下生成的订单类型：<br />onetime\_payment: 一次性付款请求创建的交易订单<br />subscription: 发起订阅付款请求创建的交易订单<br />recurring\_payment: Subotiz订阅续订服务创建的交易订单<br />token\_payment: 商家使用现有订阅合同令牌向客户扣款时创建的交易订单 |
| line\_items             | LineItem\[]        | 客户购买的商品明细                                                                                                                                                                                 |
| discounts               | Discounts          | 应用于交易的折扣，包括此交易的所有折扣信息                                                                                                                                                                     |
| closed\_at              | string             | 交易关闭时间                                                                                                                                                                                    |
| closed\_reason          | string             | 关闭原因<br />timeout: 交易支付超时<br />renewal\_failed: 订阅续订扣费失败（含重试）                                                                                                                             |
| first\_source\_channel  | string             | 交易关联的结账会话首次创建来源渠道                                                                                                                                                                         |
| last\_source\_channel   | string             | 交易关联的结账会话最后访问的来源渠道                                                                                                                                                                        |
| billing\_address        | BillingAddress     | 顾客的账单地址信息                                                                                                                                                                                 |

## ReferInfo

| 属性名           | 类型     | 描述                                                                       |
| ------------- | ------ | ------------------------------------------------------------------------ |
| country\_code | string | 客户下单时的国家 (ISO 2格式)                                                       |
| ip            | string | 客户下单时的 IP                                                                |
| device        | string | 客户设备的类型<br />pc：指个人电脑设备类型，包括台式机和笔记本电脑。<br />mobile：指移动端设备类型，包括智能手机和平板电脑。 |
| user\_agent   | string | 客户端的 user agent                                                          |

## NextAction

| 属性名      | 类型                 | 描述                               |
| -------- | ------------------ | -------------------------------- |
| type     | string             | 客户端下一步需要操作的类型：<br />redirect：重定向 |
| redirect | NextActionRedirect | 重定向信息                            |
| client   | NextActionClient   | 客户端操作信息                          |

## NextActionRedirect

| 属性名 | 类型     | 描述      |
| --- | ------ | ------- |
| url | string | 重定向 URL |

## NextActionClient

| 属性名                 | 类型     | 描述               |
| ------------------- | ------ | ---------------- |
| confirm\_url        | string | 确认支付 URL         |
| apple\_pay\_session | string | ApplePay 创建使用的数据 |

## LastPaymentError

| 属性名     | 类型     | 描述         |
| ------- | ------ | ---------- |
| code    | string | 系统返回交易返回码  |
| message | string | 系统返回交易返回说明 |

## LineItem

| 属性名         | 类型     | 描述               |
| ----------- | ------ | ---------------- |
| product\_id | string | 所购买商品的商品 ID      |
| price\_id   | string | 与所购买商品关联的定价方案 ID |
| price       | string | 应用任何折扣之前的价格      |
| quantity    | int    | 购买的商品数量          |

## Discounts

| 属性名             | 类型                       | 描述        |
| --------------- | ------------------------ | --------- |
| current\_period | CurrentPeriodDiscount\[] | 当前时期的折扣详情 |

## CurrentPeriodDiscount

| 属性名              | 类型     | 描述       |
| ---------------- | ------ | -------- |
| discount\_id     | string | 折扣的唯一标识符 |
| discount\_amount | string | 折扣金额     |
| discount\_code   | string | 使用的折扣代码  |

## BillingAddress

| 属性名               | 类型     | 描述                      |
| :---------------- | :----- | :---------------------- |
| name              | string | 收件人全名                   |
| address\_line1    | string | 地址行1，主要街道地址             |
| address\_line2    | string | 地址行2，附加地址信息             |
| country\_code     | string | 国家代码，ISO2格式（如：US、GB、CN） |
| province\_code    | string | 省/州代码（如：CA代表加利福尼亚州）     |
| city              | string | 城市名称                    |
| area              | string | 区域/区/县名称                |
| postal\_code      | string | 邮政编码                    |
| phone             | string | 不含国家代码的电话号码             |
| phone\_area\_code | string | 电话国家代码（如：+1、+44、+86）    |
| email             | string | 用于账单通知和联系的电子邮件地址        |
