🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# midasCancelPay ### midasCancelPay 开通了虚拟支付的小游戏,若扣除游戏币的订单号在有效时间内,可以通过本接口取消该笔扣除游戏币的订单 #### 正式环境 ``` <pre class="prettyprint"><ol class="linenums"><li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln">POST https</span><span class="pun">:</span><span class="com">//api.weixin.qq.com/cgi-bin/midas/cancelpay?access_token=ACCESS_TOKEN</span></code></li></ol> ``` #### 沙箱环境 ``` <pre class="prettyprint"><ol class="linenums"><li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln">POST https</span><span class="pun">:</span><span class="com">//api.weixin.qq.com/cgi-bin/midas/sandbox/cancelpay?access_token=ACCESS_TOKEN</span></code></li></ol> ``` #### 参数 ##### string openid 用户唯一标识符 ##### string appid 小程序 appId ##### string offer\_id 米大师分配的offer\_id ##### number ts UNIX 时间戳,单位是秒 ##### string zone\_id 游戏服务器大区id,游戏不分大区则默认zoneId ="1",String类型。如过应用选择支持角色,则角色ID接在分区ID号后用"\_"连接。 ##### string pf 平台 安卓:android ##### string user\_ip 用户外网 IP ##### string bill\_no 订单号,业务需要保证全局唯一;相同的订单号不会重复扣款。长度不超过63,只能是数字、大小写字母\_-|\*@ ##### string pay\_item 道具名称 ##### string sig 以上所有参数(含可选最多9个)+uri+米大师密钥,用 HMAC-SHA256签名,详见 [米大师支付签名算法](https://developers.weixin.qq.com/minigame/dev/tutorial/open-ability/midas-signature.html) ##### string access\_token [接口调用凭证](/read/wechat-game-api/297.md) ##### string mp\_sig 以上所有参数(含可选最多11个)+uri+session\_key,用 HMAC-SHA256签名,详见 [米大师支付签名算法](https://developers.weixin.qq.com/minigame/dev/tutorial/open-ability/midas-signature.html) #### 返回值 ##### Object 返回的 JSON 数据包 属性类型说明支持版本errcodenumber错误码errmsgstring错误信息bill\_nostring扣除游戏币的订单号**errcode 的合法值** 值说明0请求成功-1系统繁忙,此时请开发者稍候再试90000订单不存在90009mp\_sig签名错误90010用户未登录或登录态已过期90011sig签名错误90014订单已支付确认完成,不允许当前操作90015订单已回退,不允许当前操作90016订单处理中90017没有调用接口的权限90018参数错误#### POST 数据格式:JSON ``` <pre class="prettyprint"><ol class="linenums"><li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pun">{</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"openid"</span><span class="pun">:</span><span class="str">"odkx20ENSNa2w5y3g_qOkOvBNM1g"</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"appid"</span><span class="pun">:</span><span class="str">"wx1234567"</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"offer_id"</span><span class="pun">:</span><span class="str">"12345678"</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"ts"</span><span class="pun">:</span><span class="lit">1507530737</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"zone_id"</span><span class="pun">:</span><span class="str">"1"</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"pf"</span><span class="pun">:</span><span class="str">"android"</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"bill_no"</span><span class="pun">:</span><span class="str">"BillNo_123"</span><span class="pun">,</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"sig"</span><span class="pun">:</span><span class="str">"8bd582a6b06e38a1346fc335ebcb11c8990241bbe23118eb3d22f0ef42870a6a"</span><span class="pun">,</span></code></li> <li class="l1"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pln"> </span><span class="str">"mp_sig"</span><span class="pun">:</span><span class="str">"2651b0ee9cc7e7e1791de388d34c4d0357936e9ab7b8a9db9ba7b0537208f72b"</span></code></li> <li class="l"><code class="pcalibre9 pcalibre8 pcalibre7"><span class="pun">}</span></code></li> </ol> ``` > 原文: <https://developers.weixin.qq.com/minigame/dev/api/midas-payment/midasCancelPay.html>