分账
功能描述
收钱吧支持分账能力,即:在完成交易后即对订单金额进行分账。分账功能在购买接口和立即付接口上均已实现。即在接口原有传参基础上传入以下分账参数信息。
分账请求参数
参数 | 参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|---|
profit_sharing | 分账信息 | {} | Y |
profit_sharing:
参数 | 参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|---|
sharing_flag | 分账标识 | string | Y | 0: 不分账 1:分账 |
sharing_type | 分账类型 | string | Y | 1: 按比例分 3: 按金额分 |
model_id | 分账模型编号,由收钱吧分配 | string | Y | m1230000 |
sharing_notify_url | 分账回调地址 | string(256) | N | https://yourdomain |
receivers | 分账收款方 | [] | Y |
receivers:
参数 | 参数名称 | 类型 | 必填 | 描述 |
---|---|---|---|---|
id | 收款方编号,由收钱吧分配 | string | N | id和client_sn二选一,不能同时为空 |
client_sn | 自定义收款方编号,由收钱吧分配 | string | N | id和client_sn二选一,不能同时为空 |
ratio | 分账比例%。最小 0.001%,最大100% | string | 条件必填 | sharing_type为1时必填。例:0.003% |
sharing_amount | 分账金额,单位为分 | string | 条件必填 | sharing_type为3时必填。例:20(即0.2元) |
购买接口传参样例(body部分)
{
"request_id": "xxxx",
"brand_code": "xxxx",
"store_sn": "xxxx",
"workstation_sn": "xxxx",
"check_sn": "23429341",
"sales_sn": "xxxx",
"sales_time": "2015-12-01T15:28:36+0800",
"expired_at": "2015-12-05T15:28:36+0800",
"amount": "11",
"currency": "156",
"subject": "苹果手机",
"operator": "test",
"customer": "xxxx",
"scene": "2",
"profit_sharing": {
"sharing_flag": "1",
"sharing_type": "1", // 按比例分
"model_id": "m1230000",
"sharing_notify_url": "https://yourdomain",
"receivers": [
{
"id": "r10000000",
"ratio": "10%" // 比例
},
{
"id": "r10000000",
"ratio": "20%" // 比例
}
]
}
}
立即付接口传参样例(body部分)
{
"request_id": "xxxx",
"brand_code": "xxxx",
"store_sn": "xxxx",
"workstation_sn": "xxxx",
"check_sn": "23429341",
"sales_sn": "xxxx",
"sales_time": "2015-12-01T15:28:36+0800",
"expired_at": "2015-12-05T15:28:36+0800",
"amount": "11",
"currency": "156",
"subject": "苹果手机",
"operator": "test",
"customer": "xxxx",
"scene_type": "3",
"appid": "xxxx",
"payer_uid": "xxxx",
"tender_type": "3",
"sub_tender_type": "301",
"profit_sharing": {
"sharing_flag": "1",
"sharing_type": "1", // 按比例分
"model_id": "m1230000",
"sharing_notify_url": "https://yourdomain",
"receivers": [
{
"id": "r10000000",
"ratio": "10%" // 比例
},
{
"id": "r10000000",
"ratio": "20%" // 比例
}
]
}
}
分账逻辑
根据业务需求,收钱吧业务同事会安排将需要的各支付方式进行分账配置作为对接前置准备。当接入方在购买接口或立即付接口中传入分账参数,订单内所有符合分账配置的支付方式交易会执行分账。
例1:
分账配置:微信、支付宝分账,银行卡交易不支持分账。
下单时传分账参数,分账比例为10%。订单金额为1000元。
支付宝支付500,分账金额:50
微信支付300,分账金额:30
银行卡支付200,不分账
例2:
分账配置:微信、支付宝分账,银行卡交易不支持分账。
下单时传分账参数,分账金额为10元。订单金额为1000元。
支付宝支付500,分账金额:10
微信支付300,分账金额:10
银行卡支付200,不分账