# midas.cancelPay
Call this API at the server side. For more information, see Server API.
Cancels an order. In a Mini Game that has activated virtual payments, you can call this API to cancels an order to deduct game currency while the specified order number is still valid.
# Official Environment
POST https://api.weixin.qq.com/cgi-bin/midas/cancelpay?access_token=ACCESS_TOKEN
# Sandbox Environment
POST https://api.weixin.qq.com/cgi-bin/midas/sandbox/cancelpay?access_token=ACCESS_TOKEN
# Request Parameters
Attribute | Type | Default | Required | Description |
---|---|---|---|---|
openid | string | Yes | The unique identifier of the user. | |
appid | string | Yes | The appId of the Mini Program. | |
offer_id | string | Yes | The offer_id assigned by Midas. | |
ts | number | Yes | The UNIX timestamp, in seconds. | |
zone_id | string | Yes | The region ID of the game server, as a string-type value. If the game does not have regions, the default value is zoneId ="1". If the application supports roles, the role ID is placed after the region ID connected by "_". | |
pf | string | Yes | The platform, e.g. android. | |
user_ip | string | No | The user’s public network IP address. | |
bill_no | string | Yes | The order number, which must be globally unique within the service. Identical order numbers do not result in multiple deductions. Order numbers are composed of numbers, uppercase and lowercase English letters, underscores, and dashes and cannot exceed 63 characters. | |
pay_item | string | No | The item name. | |
sig | string | Yes | A signature calculated from all the above parameters (up to 9 with optional parameters) + uri + Midas key using the HMAC-SHA256 algorithm. For details, see Signature Calculation Algorithm. | |
access_token | string | Yes | The credentials used to call the API. | |
mp_sig | string | Yes | A signature calculated from all the above parameters (up to 11 with optional parameters) + uri + session_key using the HMAC-SHA256 algorithm. For details, see Signature Calculation Algorithm. |
# Return Value
# Object
JSON data package that is returned
Attribute | Type | Description |
---|---|---|
errcode | number | Error code |
errmsg | string | Error message |
bill_no | string | The number of the order to deduct game currency. |
Valid values of errcode
Value | Description | Minimum Version |
---|---|---|
0 | Request successful | |
-1 | System is busy. Try again later. | |
90000 | The order does not exist. | |
90009 | Incorrect mp_sig signature | |
90010 | The user is not logged in or the session has expired. | |
90011 | Incorrect sig signature | |
90014 | Payment of the order has been confirmed. This operation is not permitted. | |
90015 | The order has been refunded. This operation is not permitted. | |
90016 | The order is being processed. | |
90017 | You do not have permission to call this API. | |
90018 | Parameter error |
# POST data format: JSON
{
"openid":"odkx20ENSNa2w5y3g_qOkOvBNM1g",
"appid":"wx1234567",
"offer_id":"12345678",
"ts":1507530737,
"zone_id":"1",
"pf":"android",
"bill_no":"BillNo_123",
"sig":"8bd582a6b06e38a1346fc335ebcb11c8990241bbe23118eb3d22f0ef42870a6a",
"mp_sig":"2651b0ee9cc7e7e1791de388d34c4d0357936e9ab7b8a9db9ba7b0537208f72b"
}