Appearance
分账接收方添加接口 ¶
接口说明 ¶
参数 | 说明 |
---|---|
请求URL | /unipay/allocation/receiver/add |
请求方式 | POST |
请求类型 | application/json |
请求参数 ¶
字段名 | 变量名 | 必传 | 类型 | 长度 | 示例值 | 描述 |
---|---|---|---|---|---|---|
分账接收方编号 | receiverNo | 是 | String | 32 | 1753370980523384832 | |
所属通道 | channel | 是 | String | 20 | ||
分账接收方类型 | receiverType | 是 | String | 20 | ||
接收方账号 | receiverAccount | 是 | String | 100 | ||
接收方姓名 | receiverName | 否 | String | 100 | ||
分账关系类型 | relationType | 是 | String | 20 | ||
关系名称 | relationName | 否 | Integer | 50 | ||
用户IP | clientIp | 否 | String | 64 | 127.0.0.1 | 支持V4和V6,部分支付方式要求必填,如调用微信支付方式时 |
随机数值 | nonceStr | 否 | String | 32 | d112892e382a7093 | |
签名值 | sign | 否 | String | 64 | 072695d112892e382a7093b81e6a52af | |
请求时间 | reqTime | 是 | Long | 123123121 | 使用时间戳(秒级) |
响应结果 ¶
提示
业务数据包裹在公共响应参数
中的data
字段,在code
为0
时才会有返回数据。
字段名 | 变量名 | 必传 | 类型 | 示例值 | 描述 |
---|---|---|---|---|---|
签名 | sign | 是 | String | 072695d112892e382a7093b81e6a52af | |
状态码 | code | 否 | Integer | 0 | 为0表示成功,非0表示失败 |
错误信息 | msg | 否 | String | 关闭失败 | 状态非0时会有返回值 |
响应时间 | resTime | 是 | Long | 123123121 | 服务返回请求的时间,时间戳(秒级) |
HTTP请求示例 ¶
请求参数 ¶
json
{
"receiverNo": "123456",
"channel": "ali_pay",
"receiverType": "ali_user_id",
"receiverAccount": "208872244551643",
"relationType": "HEADQUARTER",
"clientIp": "127.0.0.1",
"sign": "9483773bf8f4d986112bb4dde6527d8a0b8d26de0d7d3394fc1420d52e31ef6b",
"reqTime": 1717498394
}
响应参数(成功) ¶
json
{
"msg": "success",
"code": 0,
"data": {
"code": 0,
"resTime": 1717498396,
"sign": "81e10c858ab881b04ac78ec3f24634e9ad5be97678f9a5afc612bb513dc00bfa"
},
"traceId": "qfOFDccKPYlD"
}
响应参数(失败) ¶
json
{
"msg": "未通过签名验证",
"code": 20000,
"traceId": "h12UXhTkPmt3"
}
SDK请求示例 ¶
提示
使用SDK可以简化接入支付的速度
java
package cn.daxpay.single.sdk.query;
import cn.daxpay.single.sdk.code.PayChannelEnum;
import cn.daxpay.single.sdk.code.SignTypeEnum;
import cn.daxpay.single.sdk.model.allocation.AllocOrderModel;
import cn.daxpay.single.sdk.model.allocation.AllocReceiversModel;
import cn.daxpay.single.sdk.net.DaxPayConfig;
import cn.daxpay.single.sdk.net.DaxPayKit;
import cn.daxpay.single.sdk.param.allocation.QueryAllocOrderParam;
import cn.daxpay.single.sdk.param.allocation.QueryAllocReceiverParam;
import cn.daxpay.single.sdk.response.DaxPayResult;
import cn.hutool.json.JSONUtil;
import org.junit.Before;
import org.junit.Test;
/**
* 查询分账订单测试类
* @author xxm
* @since 2024/6/3
*/
public class QueryAllocOrderTest {
@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 add() {
AllocReceiverAddParam param = new AllocReceiverAddParam();
param.setChannel(PayChannelEnum.ALI.getCode());
param.setClientIp("127.0.0.1");
param.setRelationType(AllocRelationTypeEnum.HEADQUARTER.getCode());
param.setReceiverNo("123456");
param.setReceiverType(AllocReceiverTypeEnum.ALI_USER_ID.getCode());
param.setReceiverAccount("2088721032251643");
DaxPayResult<AllocReceiverAddModel> execute = DaxPayKit.execute(param);
System.out.println(JSONUtil.toJsonStr(execute));
}
}