Appearance
分账完结接口 ¶
TIP
针对可以分账的支付订单,在分账完成后,可以调用此接口,结束该订单的分账。
接口说明 ¶
参数 | 说明 |
---|---|
请求URL | /uniPay/allocation/finish |
请求方式 | POST |
请求类型 | application/json |
请求参数 ¶
字段名 | 变量名 | 必填 | 类型 | 长度 | 示例值 | 描述 |
---|---|---|---|---|---|---|
商户分账单号 | bizAllocationNo | 是 | String | 100 | 123 | |
分账单号 | allocationNo | 否 | String | 32 | 456 | |
用户IP | clientIp | 否 | String | 64 | 127.0.0.1 | 支持V4和V6,部分支付方式要求必填,如调用微信支付方式时 |
随机数值 | nonceStr | 否 | String | 32 | d112892e382a7093 | |
签名值 | sign | 否 | String | 64 | 072695d112892e382a7093b81e6a52af | |
请求时间 | reqTime | 是 | Long | 123123121 | 使用时间戳(秒级) |
响应结果 ¶
提示
业务数据包裹在公共响应参数
中的data
字段,在code
为0
时才会有返回数据。
字段名 | 变量名 | 必传 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
分账单号 | allocationNo | 是 | String | 1753370980523384832 | 发起支付时传输的商户订单号 |
商户分账单号 | bizAllocationNo | 是 | String | 1753370980523384832 | 支付系统生成的支付订单号 |
支付状态 | status | 否 | String | allocation_processing | 见常量和状态表AllocOrderStatusEnum相关的描述 |
状态码 | code | 是 | Integer | 0 | 为0表示成功,非0表示失败 |
错误信息 | msg | 否 | String | 关闭失败 | 状态非0时会有返回值 |
响应时间 | resTime | 是 | Long | 123123121 | 服务返回请求的时间,时间戳(秒级) |
响应数据签名值 | sign | 是 | String | 072695d112892e382a7093b81e6a52af | 对响应内容进行签名 |
HTTP请求示例 ¶
请求参数 ¶
json
{
"allocationNo": "DEVA24060117191963000003",
"sign": "84cf593c322809a4edb86df248f81e09d01b5c8403d1efb061531784d0201553",
"reqTime": 1717327448
}
响应参数(成功) ¶
json
{
"msg": "success",
"code": 0,
"data": {
"allocationNo": "DEVA24060201494863000002",
"bizAllocationNo": "A60434",
"status": "finish",
"code": 0,
"resTime": 1717264189,
"sign": "a29b68e5d89ec6c7f2985a2680bd22b40cbffd79b4e0d8d0ec331e9b6337e1b1"
},
"traceId": "inOL4mbRjzLa"
}
响应参数(失败) ¶
json
{
"msg": "success",
"code": 0,
"data": {
"code": 1,
"msg": "分账单状态错误",
"resTime": 1717327448,
"sign": "613a86d9cb51538f3c74c69fe014bce0ad27f46bd60c0df23702e8fe6316540b"
},
"traceId": "Sv7Yghr2m013"
}
SDK请求示例 ¶
提示
使用SDK可以简化接入支付的速度
java
package cn.daxpay.single.sdk.allocation;
import cn.daxpay.single.sdk.code.PayChannelEnum;
import cn.daxpay.single.sdk.code.PayMethodEnum;
import cn.daxpay.single.sdk.code.SignTypeEnum;
import cn.daxpay.single.sdk.model.allocation.AllocationModel;
import cn.daxpay.single.sdk.model.pay.PayModel;
import cn.daxpay.single.sdk.model.sync.AllocSyncModel;
import cn.daxpay.single.sdk.net.DaxPayConfig;
import cn.daxpay.single.sdk.net.DaxPayKit;
import cn.daxpay.single.sdk.param.allocation.AllocFinishParam;
import cn.daxpay.single.sdk.param.allocation.AllocReceiverParam;
import cn.daxpay.single.sdk.param.allocation.AllocSyncParam;
import cn.daxpay.single.sdk.param.allocation.AllocationParam;
import cn.daxpay.single.sdk.param.pay.PayParam;
import cn.daxpay.single.sdk.response.DaxPayResult;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import org.junit.Before;
import org.junit.Test;
import java.util.Collections;
/**
* 支付分账测试
* @author xxm
* @since 2024/4/6
*/
public class AllocationTest {
@Before
public void init() {
// 初始化支付配置
DaxPayConfig config = DaxPayConfig.builder()
.serviceUrl("http://127.0.0.1:9000")
.signSecret("123456")
.signType(SignTypeEnum.HMAC_SHA256)
.build();
DaxPayKit.initConfig(config);
}
/**
* 分账完结
*/
@Test
public void allocationFinish() {
// 分账完结参数
AllocFinishParam param = new AllocFinishParam();
param.setAllocationNo("DEVA24060117191963000003");
DaxPayResult<AllocationModel> execute = DaxPayKit.execute(param);
System.out.println(JSONUtil.toJsonStr(execute));
}
}