- 数据按照字典升序进行排序
- 拼接参数格式: key=value&key=value
- 尾部拼接提供方派发的md5-key.
- 最后使用md5加签.
$key = "lW17NUiNN7vDn7FopcCid0BLyfxuZbHz";
$data = [
"mch_id": "MC_YBU54VWTOANZ",
"third_sn": "TRD_20211209153001",
"amount": "10.00",
"jump_type": "wx_wap",
"goods_name": "测试商品",
"notify_url": "https://bing.com.cn/api",
"return_url": "https://bing.com.cn",
"sign": "554d7cc435533e264239027083bbb544",
];
ksort($data);
$signStr = '';
foreach ($data as $k => $v) {
$signStr .= $k . '=' . $v . '&';
}
$signStr = preg_replace('/&$/', '', $signStr);
$signStr .= $key;
echo md5($signStr);
- 请求方法:
- 请求URL:
https://domain.com/addons/yun_shop/api.php?route=plugin.pay-station.payment.order.unified
{
"mch_id": "MC_YBU54VWTOANZ",
"third_sn": "TRD_20211209153001",
"amount": "10.00",
"pay_type": "wx_wap",
"goods_name": "测试商品",
"notify_url": "https://bing.com.cn/notify_url",
"return_url": "https://bing.com.cn/return_url",
"sign": "554d7cc435533e264239027083bbb544"
}
| 参数名 | 类型 | 必填 | 描述 | 参与签名 |
|---|
| i | int | 是 | 站点唯一值 | 否 |
| mch_id | string | 是 | 商户号 | 是 |
| third_sn | string | 是 | 订单号 | 是 |
| amount | string | 是 | 金额 | 是 |
| pay_type | string | 是 | 支付类型 (wx_wap = 微信H5, wx_pub = 微信公众号, wx_lite = 微信小程序) | 是 |
| goods_name | string | 是 | 商品名称 | 是 |
| notify_url | string | 是 | 通知地址 | 是 |
| return_url | string | 否 | 返回地址 | 选填(填写时参与签名) |
| sign | string | 是 | 签名 | 否 |
{
"result": 1,
"msg": "ok",
"data": {
"out_order_no": "PSN20250316194235BUZPTP",
"jump_url": "http://localhost:8000/addons/yun_shop/?menu#/pay_station/pay_start?out_order_no=PSN20250316194235BUZPTP&i=1"
}
}
| 参数名 | 类型 | 描述 |
|---|
| result | int | 结果 0 失败, 1成功 |
| msg | string | 信息 |
| data | object | 数据 |
| 参数名 | 类型 | 描述 |
|---|
| out_order_no | string | 订单号 |
| jump_url | string | 跳转地址 |
- 请求方法:
- 请求URL:
https://domain.com/addons/yun_shop/api.php?route=plugin.pay-station.payment.order.query
{
"i": 1,
"third_sn": "TRD_20211209153001",
"sign": "cb7d3cc631c3c8cd893468aeb0427c20"
}
| 参数名 | 类型 | 必填 | 描述 | 参与签名 |
|---|
| i | int | 是 | 站点唯一值 | 否 |
| third_sn / pay_sn | string | 是 | 订单号 / 收银台支付单号 | 是 |
| sign | string | 是 | 签名 | 否 |
{
"result": 1,
"msg": "ok",
"data": {
"mch_id": "MC_YBU54VWTOANZ",
"third_sn": "TRD_20211209153001",
"pay_sn": "PSN20250316194235BUZPTP",
"pay_status": 0,
"pay_status_name": "未支付",
"amount": "10.00",
"goods_name": "测试商品",
"created_at": "2025-03-16 19:42:35"
}
}
| 参数名 | 类型 | 描述 |
|---|
| result | int | 结果 0 失败, 1成功 |
| msg | string | 信息 |
| data | object | 数据 |
| 参数名 | 类型 | 描述 |
|---|
| mch_id | string | 商户号 |
| third_sn | string | 订单号 |
| pay_sn | string | 支付单号 |
| pay_status | int | 支付状态 0 未支付, 1已支付 |
| pay_status_name | string | 支付状态名称 |
| amount | string | 支付金额 |
| goods_name | string | 商品名称 |
| created_at | string | 创建时间 |
- 请求方法:
- 请求URL:
https://domain.com/addons/yun_shop/api.php?route=plugin.pay-station.payment.order.refund
{
"i": 1,
"mch_id": "MC_YBU54VWTOANZ",
"third_refund_no": "RN012031023001203103",
"third_sn": "TRD_20211209153001",
"amount": "11.00",
"sign": "29f5ff237b6e3b8995c734d6a68df67d"
}
| 参数名 | 类型 | 必填 | 描述 | 参与签名 |
|---|
| i | int | 是 | 站点唯一值 | 否 |
| mch_id | string | 是 | 商户号 | 是 |
| third_refund_no | string | 是 | 退款单号 | 是 |
| third_sn | string | 是 | 订单号 | 是 |
| amount | string | 是 | 退款金额 | 是 |
| sign | string | 是 | 签名 | 否 |
{
"result": 1,
"msg": "操作成功",
"data": ""
}
| 参数名 | 类型 | 描述 |
|---|
| result | int | 结果 0 失败, 1成功 |
| msg | string | 信息 |
| data | string | |