Order Cancel (Gateway Pay)
|
Canceling an order will close the payment link and prevent customers from accessing it to initiate new payments. However, if a customer has already saved the QR code to their device, they may still be able to complete the payment using that QR. For card payments, if the status is already in progress, the order cannot be canceled. This is because the customer may be in the middle of the OTP process, and allowing cancellation at this stage could result in a successful payment after the order has been canceled. |
API method
URL |
|
Method |
POST |
Parameter organization format |
application/x-www-form-urlencoded |
Order Cancel Request Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
sign |
String(256) |
YES |
b000e9b6ec3fbda482d96a3d7c75c6956a5864336c3098462525e7229e8e046e490939a3e8b320a6c68eb63795a25b79d8c74f042f0972039bb5fe9b861cefb4 |
To verify the accuracy of the request message, please refer to the signature creation method in the section Signature Creation. |
appid |
String(32) |
YES |
mch35000 |
Your Merchant Number. Check on how to find your appid/Merchant No.. The format is mch{Merchant No}. |
lang |
String(256) |
YES |
The default language is English if no specification. Value range:
|
|
nonce_str |
String(32) |
YES |
Random string, must be unique |
|
time_stamp |
String(256) |
YES |
time stamp example: "time_stamp": "20190622131804" |
|
{
"mch_order_no": "test_mch_order_no",
"appid": "mch35005",
"nonce_str": "472393a69ca0b86522e1ffa98947f6c7",
"time_stamp": "2022091904121212S",
"sign": "2d6dc811009b073d7a7b4a4426cc88abb00d66fa75308211088d3305cfe13c44f49af8c6cc251bcd1351a0e7ef2844a9056386d186f8525b9419b9329eeb863c21d5d1015abdd2aa7df5401e83d856a5be92a2257b24cfcae30abcb6a32a01abaf703cdfa0c8f8fc0bb9a3dff06497506f284b8ab587c02570ab19091cba2147"
}
Order Cancel SUCCESS Response Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
code |
int |
YES |
0 |
code msg * 0: Successful operation * -1: Incorrect business information * -2: Failed to verify merchant’s signature * -3: The order does not exist * -4: The order has been paid successfully, this operation cannot be performed * -5: The order has been cancelled and this operation cannot be repeated * -6: Cancel order failed |
message |
String(128) |
Detailed description of result |
||
msg |
String(128) |
YES |
system error |
the detailed description of the error |
{
"code": 0,
"msg": "操作成功",
"data": "取消成功",
"message": "操作成功"
}
after gateway order query again will display like this
{
"sign": "8cc824680208d28c04c9adb1ca2d304958c29846a7b778cf959540899721b5901c72f7360cbd7ccb64ee6b0b57e82f97373d8c90b57343cf5550cd8e03dea306",
"data": {
"cash_fee": "",
"attach": "",
"result": "CLOSED",
"openid": "",
"rate": "",
"channel": "",
"nonce_str": "",
"mch_order_no": "k_20210520_24",
"cash_fee_type": "",
"pay_mch_order_no": "2106021528410423",
"total_fee": 2000,
"fee_type": "THB",
"ksher_order_no": "",
"channel_order_no": "",
"time_end": "",
"appid": "mch29217"
},
"message": "操作成功",
"code": 0,
"msg": "操作成功"
}
Order Cancel Fail Response Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
code |
int |
YES |
0 |
code msg * -1: Incorrect business information
|
message |
String(128) |
Detailed description of result |
||
msg |
String(128) |
YES |
system error |
the detailed description of the error |
{ "code": -1, "msg": "商户信息错误", "message": "商户信息错误"}
{ "code": -2, "msg": "验证商户签名失败", "message": "验证商户签名失败"}
{ "code": -3, "msg": "该订单不存在", "message": "该订单不存在"}
{ "code": -4, "msg": "该订单已支付成功,不能进行此操作", "message": "该订单已支付成功,不能进行此操作"}
{ "code": -5, "msg": "该订单已被取消,不能重复进行此操作", "message": "该订单已被取消,不能重复进行此操作"}
{ "code": -6, "msg": "取消订单失败", "message": "取消订单失败"}