发起分账
开发环境
http://dev-cn.your-api-server.com
开发环境
http://dev-cn.your-api-server.com
POST
https://open.douyin.com/api/apps/trade/v2/settle/create_settle
注意事项
分账规则
举个例子 小程序 A 是核销 D+3 分账,用户的一笔订单 X 买了 5 张团购券 按整单分账时,对于订单 X,其中 3 张先核销,剩余 2 张再退款,最终退款完成的时间就是订单到达终态的时间。订单到达终态 3 天后,则可以发起分账 按券分账时,对于订单 X,其中 1 张券先核销,核销 3 天后可以发起这张券的分账 如果是次卡订单,对于订单 X,履约了第 1、2 次发起分账,则本次分账会将第 1、2 次对应的金额进行结算
分账类型
分账发起方
权限要求
请求参数
名称 | 类型 | 是否必填 | 描述 | 示例值 |
---|---|---|---|---|
merchant_uid | string | 是 | 进件商户 id(除了卖家以外的其他分账方) | 分账方商户号 1 |
amount | int64 | 是 | 分账金额,单位[分],amount>0 | 100 |
curl -X POST '
-H 'Content-Type:application/json'
--data-raw '{
"out_order_no":"out_order_example_1",
"out_settle_no":"out_settle_example_1",
"item_order_id":"ot78318372940872837161",
"settle_desc":"分账描述",
"settle_params":"[{\"merchant_uid\":\"分账方商户号1\",\"amount\":100}]",
"cp_extra":"test",
"notify_url":"https://www.xxxx.com"
}'
错误码
子错误码 | 错误提示 | 建议解决方案 |
---|---|---|
23000 | 抱歉,出错了!请稍后重试 | 原单号发起重试 |
23001 | bad app_id | 检查请求参数 |
23002 | 订单id,分账单id至少指定一个 | |
23003 | out_order_no不能为空 | |
23004 | out_settle_no不能为空 | |
23005 | settle_desc不能为空 | |
23006 | cp_extra too long | |
23007 | settle_param too long | |
23008 | 分账方商户号不能为空 | |
23009 | 分账方金额不能小于1 | |
23010 | settle_desc too long | |
23101 | 订单不存在,无法分账 | 检查订单号是否正确,或者订单号与appid是否匹配 |
23102 | 订单未支付,无法分账 | 检查订单是否支付 |
23103 | 小程序在禁止分账名单中,无法分账 | |
23104 | 服务商在禁止分账名单中,无法分账 | |
23105 | 支付后不满N天,无法分账 | |
23106 | 核销后不满N天,无法分账 | |
23107 | 订单未完成,无法分账 | 查询券状态,检查是否每张券都已核销/退款 |
23108 | 单笔订单分账次数过多 | |
23109 | 分账金额超过授权比例 | |
23110 | 服务商无对应小程序分账授权 | |
23111 | out_settle_no已存在,请用查询接口查询分账结果 | 建议用分账查询接口查询分账结果,有以下场景:分账已成功,则无需处理分账处理中,说明分账在受理中,等待处理结果即可分账失败,尝试用原out_settle_id重新发起分账,如果依旧失败则换一个新out_settle_id发起分账,如果依旧失败就发起oncall |
23112 | 已无可分账金额 | 检查订单是否已退款或已分账 |
23113 | 该订单不允许分账 | |
23117 | 该订单属于自动结算订单, 无需请求分账 | 属于自动分账的小程序,可以按订单维度查询分账 |
23118 | 不允许整单结算,请按券发起结算 | 一笔订单中已有券结算,其他券也只能按券结算 |
23119 | 不允许发起券结算 | 支付D+N结算的小程序不允许发起券结算 |
23120 | 券未核销,无法分账 | 查询券状态,检查券是否核销 |
23121 | 券结算功能灰度中,请联系运营开通 |
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://open.douyin.com/api/apps/trade/v2/settle/create_settle' \
--header 'Content-Type: application/json' \
--data-raw '{
"out_order_no":"out_order_example_1",
"out_settle_no":"out_settle_example_1",
"settle_desc":"分账描述",
"settle_params":"[{\"merchant_uid\":\"分账方商户号1\",\"amount\":100}]",
"cp_extra":"test",
"notify_url":"https://www.xxxx.com"
}'
响应示例响应示例
200 - 示例 1
{
"data": {
"settle_id": "string",
"inner_settle_id": "string"
},
"extra": {
"description": "string",
"error_code": 0,
"logid": "string",
"now": 0,
"sub_description": "string",
"sub_error_code": 0
}
}
请求参数
Body 参数application/json