交易取消
适用于线下POS支付场景
该接口用于通过云端发起对未支付的订单发起取消操作。
当指令发起后正在等待用户支付的页面会关闭。
[!TIP|style:flat]
该接口基于云端调用 POS 设备的方案。
如需通过局域网(LAN)方式调用 POS,请联系我们获取对应的 API 接入说明文档。
API URL:https://mapi.yabandpay.com/Payments
Method:POST
POST data type:Json
| 参数 | 类型 | 描述 | 是否必填 |
|---|---|---|---|
| user | String | 设备的TID | 必填 |
| sign | String | 签名 | 必填 |
| method | String | v3.POSCancel | 必填 |
| time | Long | 时间戳 | 必填 |
- 参数
| Parameter | Type | Description | 是否必填 |
|---|---|---|---|
| tid | string | 设备的TID | 必填 |
| trade_id | String | YabandPay订单编号 | 必填 |
| request_id | String | 请求id需保持唯一,建议24以上位数字+字母 | 必填 |
签名示例:
拼接为URL方式并排序后的字符串
"method=v3.POSReversal&request_id=a7z1lox4l6z6mdx1udgn5gtezasze1x0&tid=T125119061&time=1555498137&trade_id=4a49ffb3-a30f-ba92-9422-1969afb6f121&user=T125119061"
得到的 stringA 使用 secret_key做签名
得到的签名如下:
"81617629b3f26a88ec7cdf8f4b989fa0368d40be34969af3958cbcb94289c544"
提交示例:
{
"user": "T125119061",
"sign": "81617629b3f26a88ec7cdf8f4b989fa0368d40be34969af3958cbcb94289c544",
"method": "v3.POSCancel",
"time": 1555498137,
"data": {
"tid": "T125119061",
"trade_id": "4a49ffb3-a30f-ba92-9422-1969afb6f121",
"request_id": "a7z1lox4l6z6mdx1udgn5gtezasze1x0"
}
}
返回示例:
{
"status": true,
"code": "200",
"data": {
"type": "payment",
"user": "T125119061",
"amount": "0.10",
"currency": "EUR",
"trade_id": "4a49ffb3-a30f-ba92-9422-1969afb6f121",
"description": "YabandPay test",
"order_id": "280244567856723026",
"createDate": "1706771212",
"demo": "test",
"transaction_id": "",
"state": "cancelled"
},
"message": "",
}
更多信息:
返回结果:
若调用成功,则返回
"status": true若调用失败,则返回
"status": false
我们强烈建议同时使用订单查询和异步通知来同步和更新支付状态,以确保支付信息的实时准确性。
返回代码:
| Status | Code | Message |
|---|---|---|
| true | 200 | |
| false | -3001 | Required field is missing |
| false | -3002 | duplicate request_id |
| false | -4111 | Exceed cancel window |
| false | -4112 | The transaction has been cleared cannot be cancelled |
| false | -4114 | The trade_id does not exist |
| false | -4115 | The transaction cannot be cancelled |
| false | -4116 | The transaction has been cancelled |
| false | -4117 | The transaction has been Expired |