接口说明
1143字约4分钟
1. 通信协议
商户接入HaiPay服务,调用API须遵循以下规则:
类型 | 说明 |
---|---|
传输方式 | 为保证交易安全性,采用HTTPS传输 |
提交方式 | 采用POST方法提交 |
数据格式 | 提交和返回数据都为application/json格式 |
字符编码 | 统一采用UTF-8字符编码 |
签名算法 | SHA256WithRSA |
签名要求 | 请求和接受数据均需要校验签名,详细方法参考 配置与签名 |
2. 接口结构
如下是调用HaiPay接口的http结构,接口名称放到请求地址后面,data里边的内容为不同业务结构拼接而成的报文
POST https://uat-trade.xwinpay.tech/{接口地址}
X-MERCHANT-CODE: 商户编码
X-API-KEY: 商户后台获取apiKey
{
// 业务参数
"param": {
"accountNumber": "",
"amount": 50000,
"app": "NICE",
****,
****,
****,
},
// 根据请求参数param使用privateKey签名
"sign": "SQiqFRTmBn0***4Yz8iUCdeyWi/JObp9mXzXfNCQ+zbOCQ="
}
请求地址:
联调环境 | 请求地址 |
---|---|
测试 | https://uat-trade.xwinpay.tech |
生产 | https://trade.xwinpay.tech |
3. 接口列表
详情查看 接口文档 。
4. 参数
请求接口公共参数
请求头参数
参数名 | 必须 | 类型 | 说明 |
---|---|---|---|
X-MERCHANT-CODE | 是 | Http Header (String) | 商户编码 |
X-API-KEY | 是 | Http Header (String) | 商户后台获取apikey |
请求体参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
param | 是 | Object | 业务参数 |
sign | 是 | String | 签名(详情查看 配置与签名) |
请求示例:
POST https://uat-trade.xwinpay.tech/{接口地址}
X-MERCHANT-CODE: 商户编码
X-API-KEY: 商户后台获取apiKey
{
// 业务参数
"param": {
"accountNumber": "",
"amount": 50000,
"app": "NICE",
****,
****,
****,
},
// 根据请求参数param使用privateKey签名
"sign": "SQiqFRTmBn0***4Yz8iUCdeyWi/JObp9mXzXfNCQ+zbOCQ="
}
响应接口公共参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
code | 是 | Integer | 接口状态(200: 接口响应正常) |
message | 是 | String | 接口描述 |
data | 是 | Object | 业务数据 |
响应示例:
{
"code": 200,
"message": "操作成功",
"data": {
"merchantNo": "58256833",
"merchantOrderNo": "5825683320230508569",
****,
****,
****
}
}
错误编码
错误编码 | 英文回复 | 中文含义 |
---|---|---|
200 | Request successful | |
415 | parameter passing exception | 参数传递异常 |
500 | Please contact technical support for business exceptions. | 业务异常,请联系技术支持 |
4001 | Merchant code cannot be empty | 商户编码不能为空 |
4002 | Merchant does not exist | 商户不存在 |
4003 | Merchant APIKEY is incorrect | 商户APIKEY不正确 |
4004 | Merchant APIKEY cannot be empty | 商户APIKEY不能为空 |
4005 | The sign signature cannot be empty. | sign签名不能为空 |
4006 | Sign Failure | sign验签失败 |
4007 | The current merchant does not have this type of currency account | 当前商户未开通该类货币账户 |
4008 | The current merchant balance is insufficient and the payment on behalf of the merchant has failed! | 当前商户余额不足,代付失败! |
40081 | There is an outstanding escrow order on the account! | 账户存在未完成代付订单! |
40082 | Payment on behalf of an order creation exception! | 代付创建订单异常! |
40083 | Payment on behalf of an order rate calculation anomaly! | 代付订单费率计算异常! |
4009 | Duplicate Merchant Order Number | 商户订单号重复 |
4010 | Merchant order number not passed | 商户订单号未传递 |
4011 | Missing parameter error | 缺少参数错误 |
4012 | Merchant order does not exist | 商户订单不存在 |
4013 | Current order parameter validation error | 当前订单参数验证错误 |
4014 | channel request param error | 通道请求参数错误 |
4015 | No permission to pay for products, please contact the administrator | 支付产品无权限,请联系管理员 |
4016 | Merchant fee calculation method is wrong | 商户手续费计算方式错误 |
4017 | amount in excess of limit | 金额超出限制 |
4018 | bank request param error | 银行参数错误 |
4019 | ewallet request param error | 钱包参数错误 |
4020 | Abnormal rate setting | 费率设置异常 |
4021 | The bank has suspended use, please contact the administrator. | 银行暂停使用,请联系管理员 |
4022 | param error" | 参数错误 |
4023 | reached daily transaction count limit | 已达到每日交易笔数上限 |
4024 | transaction must between %d and %d" | 单笔交易金额限制 |
4025 | The daily transaction volume has reached %d" | 日交易量已达 |
5001 | The payment channel is temporarily unavailable, please try again later. | 支付渠道暂不可用,请稍后再试 |
5002 | Order data does not exist | 订单数据不存在 |
5003 | Unknown handling fee calculation method | 未知手续费计算方式 |
5004 | Not getting the fee calculation method | 未获取手续费计算方式 |
5006 | Payment request is abnormal, please check the parameters | 支付请求异常,请检查参数 |
5007 | Payment product is not configured | 支付产品未配置 |
5008 | Payment exception | 支付异常 |
50071 | The merchant has not configured payment products | 商户未配置支付产品 |
40084 | Abnormal data in access channel for payment orders | 代付订单接入通道数据异常 |
40085 | Pipeline write exception | 流水写入异常 |
公共订单状态枚举
参数名 | 说明 |
---|---|
PENDING | 交易中 |
COMPLETED | 入账成功 |
FAILED | 交易失败 |
CANCEL | 取消订单 |
NO_PAY | 未支付 |