交易撤销
适用于线下POS支付场景
该接口用于通过云端发起对已成功交易的撤销操作。
交易撤销仅支持当日交易,且仅可进行全额撤销。
如需处理部分撤销或非当日交易,请使用退款接口。
撤销指令下发后,POS 终端将实时展示撤销处理过程及最终结果,以便商户和用户即时确认撤销状态。如需执行静默撤销(不在 POS 终端展示处理过程),请使用取消支付接口。
在调用本接口前,请务必确认 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.POSReversal | 必填 |
| 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.POSReversal",
"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 |