https://p.unity.cn
摘要: 创建交易记录
请求体结构: economyCreatePaymentRequest
{
"personaId": "1000318001",
"outTradeNo": "tradeNo1001",
"paymentMethod": "alipay.trade.page.pay",
"totalAmount": 100,
"productSlug": "testProduct2",
"expiredAt": "2025-05-08T16:00:00Z"
}
响应结构: economyCreatePaymentResponse
{
"transactionId": "5cb7a879-0f2f-4893-8d04-909d12d7b214",
"outTradeNo": "tradeNo1001",
"transactionStatus": "pending",
"totalAmount": 100
}
响应结构: rpcStatus
摘要: 支付回调
请求体结构: economyPaymentNotifyRequest
{
"outTradeNo": "tradeNo1001",
"tradeState": "TRADE_SUCCESS",
"totalAmount": 100,
"paymentSuccess": true
}
响应结构: economyPaymentNotifyResponse
{
"transaction": {
"transactionUUID": "5cb7a879-0f2f-4893-8d04-909d12d7b214",
"idDomainID": "",
"personaId": "1000318001",
"userId": "1000318001",
"transactionType": "RealMoneyPurchase",
"productSlug": "testProduct2",
"product": {
"idDomainID": "",
"slugName": "testProduct2",
"displayName": "测试商品2",
"category": {
"id": "301",
"idDomainID": "aba6f054-8d1e-49c1-afc5-ab3ec1820431",
"slugName": "cate",
"displayName": "目录",
"customData": {},
"createdAt": "2024-10-10T08:46:21.976505Z",
"createdBy": "",
"modifiedAt": "2024-10-10T08:46:21.976505Z",
"modifiedBy": ""
},
"costs": [
{
"idDomainID": "",
"resourceType": "Currency",
"slugName": "CNY",
"displayName": "人民币",
"maxValue": 0,
"customData": {},
"quantity": 100
}
],
"rewards": [
{
"idDomainID": "",
"resourceType": "Item",
"slugName": "item",
"displayName": "item",
"maxValue": 0,
"customData": {},
"quantity": 1
}
],
"startTime": "2025-02-24T08:33:35.145036Z",
"limitCount": 0,
"limitPeriodDay": "",
"limitPeriodHour": "",
"customData": {},
"published": true,
"createdAt": "2025-02-24T08:33:35.143171Z",
"createdBy": "",
"modifiedAt": "2025-02-24T08:33:36.312812Z",
"modifiedBy": ""
},
"status": "Fulfilled",
"customData": {},
"paidAt": "2025-02-24T09:17:14.561723Z",
"fulfilledAt": "2025-02-24T09:17:14.569701Z",
"quantity": 1
}
}
响应结构: rpcStatus
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| id | string | | 否 | 商品目录ID |
| idDomainID | string | | 否 | IdDomain ID |
| slugName | string | | 否 | app下商品目录的唯一标识 |
| displayName | string | | 否 | 商品目录的名称 |
| customData | object | | 否 | 自定义商品目录属性 |
| createdAt | string | date-time | 否 | 创建时间(UTC) |
| createdBy | string | | 否 | 创建用户 |
| modifiedAt | string | date-time | 否 | 最后修改时间(UTC) |
| modifiedBy | string | | 否 | 最后修改用户 |
标题: CreatePaymentRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| personaId | string | | 是 | 购买者的角色ID,不可为空 |
| outTradeNo | string | | 是 | 自定义唯一订单号,不可为空,不可重复 |
| paymentMethod | string | | 是 | 交易渠道,可自定义渠道名称,不可为空 |
| totalAmount | integer | int64 | 是 | 订单总金额,单位为分,取值范围为 [1,10000000000]。金额不能为0。需要与购买的uos passport经济系统中的商品价格一致 |
| productSlug | string | | 是 | uos passport经济系统中的商品slugName,不可为空 |
| expiredAt | string | date-time | 否 | 可选参数,订单的失效时间。 |
{
"personaId": "1000318001",
"outTradeNo": "tradeNo1001",
"paymentMethod": "alipay.trade.page.pay",
"totalAmount": 100,
"productSlug": "testProduct2",
"expiredAt": "2025-05-08T16:00:00Z"
}
标题: CreatePaymentResponse
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| transactionId | string | | 否 | 交易UUID |
| outTradeNo | string | | 否 | 自定义唯一订单号 |
| transactionStatus | string | | 否 | 交易状态 |
| totalAmount | integer | int64 | 否 | 订单总金额,单位为分 |
{
"transactionId": "5cb7a879-0f2f-4893-8d04-909d12d7b214",
"outTradeNo": "tradeNo1001",
"transactionStatus": "pending",
"totalAmount": 100
}
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| startTime | string | date-time | 否 | 打折开始时间,默认为当前时间 |
| endTime | string | date-time | 否 | 打折结束时间,默认为空 |
| discountCosts | array<economyProductEntity> | | 否 | 购买该商品需要消耗的资源或者货币 |
| properties | object | | 否 | 折扣属性 |
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| idDomainID | string | | 否 | IdDomain ID |
| slugName | string | | 否 | 商品唯一标识slug |
| displayName | string | | 否 | 商品名称 |
| category | economyCategory | | 否 | 商品目录 |
| costs | array<economyProductEntityDetail> | | 否 | 购买该商品需要消耗的物品或者货币资源详情 |
| rewards | array<economyProductEntityDetail> | | 否 | 购买该商品可以获得的资源详情 |
| startTime | string | date-time | 否 | 商品开始售卖的时间 |
| endTime | string | date-time | 否 | 商品结束售卖的时间 |
| limitCount | integer | int64 | 否 | 商品限购数量,缺省为0,代表不限购 |
| limitPeriodType | economyLimitPeriodType | | 否 | 商品限购周期类型(EveryDay/EveryWeek/EveryMonth),例如商品每周限购2次 |
| limitPeriodDay | string | | 否 | 商品限购周期的具体日子,如果周期类型是EveryWeek,则可以配置0-6(Sun-Sat);如果周期类型是EveryMonth,则可以配置日期(1-31) |
| limitPeriodHour | string | | 否 | 商品限制周期的具体时间,可配置成0-23 |
| customData | object | | 否 | 商品自定义属性 |
| published | boolean | | 否 | 是否发布 |
| createdAt | string | date-time | 否 | 创建时间(UTC) |
| createdBy | string | | 否 | 创建用户 |
| modifiedAt | string | date-time | 否 | 最后修改时间(UTC) |
| modifiedBy | string | | 否 | 最后修改用户 |
| sequence | integer | int64 | 否 | 目录下的展示顺序 |
| discounts | array<economyDiscount> | | 否 | 折扣信息 |
标题: - EveryDay: 每日限购
- EveryWeek: 每周限购
- EveryMonth: 每月限购
| 枚举值 | 描述 |
|---|
EveryDay | - |
EveryWeek | - |
EveryMonth | - |
标题: PaymentNotifyRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| outTradeNo | string | | 是 | 支付完成的自定义唯一订单号,不可为空 |
| tradeState | string | | 是 | 交易状态,保存支付方返回的交易状态,不可为空 |
| totalAmount | integer | int64 | 是 | 支付总金额,单位为分,需和订单金额保持一致 |
| paymentSuccess | boolean | | 是 | 交易是否成功 |
{
"outTradeNo": "tradeNo1001",
"tradeState": "TRADE_SUCCESS",
"totalAmount": 100,
"paymentSuccess": true
}
标题: PaymentNotifyResponse
{
"transaction": {
"transactionUUID": "5cb7a879-0f2f-4893-8d04-909d12d7b214",
"idDomainID": "",
"personaId": "1000318001",
"userId": "1000318001",
"transactionType": "RealMoneyPurchase",
"productSlug": "testProduct2",
"product": {
"idDomainID": "",
"slugName": "testProduct2",
"displayName": "测试商品2",
"category": {
"id": "301",
"idDomainID": "aba6f054-8d1e-49c1-afc5-ab3ec1820431",
"slugName": "cate",
"displayName": "目录",
"customData": {},
"createdAt": "2024-10-10T08:46:21.976505Z",
"createdBy": "",
"modifiedAt": "2024-10-10T08:46:21.976505Z",
"modifiedBy": ""
},
"costs": [
{
"idDomainID": "",
"resourceType": "Currency",
"slugName": "CNY",
"displayName": "人民币",
"maxValue": 0,
"customData": {},
"quantity": 100
}
],
"rewards": [
{
"idDomainID": "",
"resourceType": "Item",
"slugName": "item",
"displayName": "item",
"maxValue": 0,
"customData": {},
"quantity": 1
}
],
"startTime": "2025-02-24T08:33:35.145036Z",
"limitCount": 0,
"limitPeriodDay": "",
"limitPeriodHour": "",
"customData": {},
"published": true,
"createdAt": "2025-02-24T08:33:35.143171Z",
"createdBy": "",
"modifiedAt": "2025-02-24T08:33:36.312812Z",
"modifiedBy": ""
},
"status": "Fulfilled",
"customData": {},
"paidAt": "2025-02-24T09:17:14.561723Z",
"fulfilledAt": "2025-02-24T09:17:14.569701Z",
"quantity": 1
}
}
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| resourceSlug | string | | 否 | 资源的唯一标识slug |
| quantity | integer | int64 | 否 | 资源数量 |
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| idDomainID | string | | 否 | IdDomain ID |
| resourceType | economyResourceType | | 否 | 资源类型 |
| slugName | string | | 否 | 资源唯一标识slug |
| displayName | string | | 否 | 资源名称 |
| maxValue | integer | int64 | 否 | 资源数量上限 |
| customData | object | | 否 | 资源自定义属性 |
| quantity | integer | int64 | 否 | 资源数量 |
| namespace | string | | 否 | 资源类别/命名空间 |
| originalQuantity | integer | int64 | 否 | 原价,打折前资源数量,仅在商品有折扣时会显示 |
标题: - VirtualCurrency: 虚拟货币
- Item: 物品
- Currency: 货币(系统内置)
| 枚举值 | 描述 |
|---|
VirtualCurrency | - |
Item | - |
Currency | - |
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| transactionUUID | string | | 否 | 交易流水号 |
| idDomainID | string | | 否 | IdDomain ID |
| personaId | string | | 否 | 角色ID |
| userId | string | | 否 | 用户ID |
| transactionType | economyTransactionType | | 否 | 交易类型(RealMoneyPurchase/VirtualPurchase) |
| productSlug | string | | 否 | 商品唯一标识slug |
| product | economyExpandedProduct | | 否 | 交易商品快照 |
| status | economyTransactionStatus | | 否 | 交易状态 (Charged/Fulfilled/FulfillFailed/Pending/ChargeFailed/ResourceReturned/Refunded) |
| customData | object | | 否 | 自定义属性 |
| paidAt | string | date-time | 否 | 支付时间 |
| fulfilledAt | string | date-time | 否 | 交易完成时间 |
| quantity | integer | int64 | 否 | 交易商品个数 |
| outTradeNo | string | | 否 | 线上支付商户订单号 |
| paymentMethod | string | | 否 | 线上支付方式 |
| tradeState | string | | 否 | 线上支付状态 |
| createdAt | string | date-time | 否 | 创建时间 |
| expiredAt | string | date-time | 否 | 订单的支付链接超时时间 |
| totalAmount | integer | int64 | 否 | 订单支付总金额,单位为分 |
标题: - Charged: 已扣费
- Fulfilled: 已完成
- FulfillFailed: 交易失败
- Pending: 待支付
- ChargeFailed: 支付失败
- Expired: 订单已超时([deprecated],请使用查询订单返回值中的expiredAt判断)
- ResourceReturned: 已退还订单所得物品
- Refunded: 退款已完成
| 枚举值 | 描述 |
|---|
Charged | - |
Fulfilled | - |
FulfillFailed | - |
Pending | - |
ChargeFailed | - |
Expired | - |
ResourceReturned | - |
Refunded | - |
标题: - RealMoneyPurchase: 真实货币购买
| 枚举值 | 描述 |
|---|
RealMoneyPurchase | - |
VirtualPurchase | - |
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|
| code | integer | int32 | 否 | - |
| message | string | | 否 | - |
| details | array<protobufAny> | | 否 | - |