1.3 撤销订单接口
<h2>撤销订单接口</h2>
<p><strong>接口地址</strong>:<code>/pay/api/1.0/cancelOrder</code></p>
<p><strong>请求方式</strong>:<code>POST</code></p>
<p><strong>请求数据类型</strong>:<code>application/json</code></p>
<p><strong>响应数据类型</strong>:<code>application/json</code></p>
<p><strong>接口描述</strong>:</p>
<p>本接口支持<code>条码支付</code>撤销。
建议先发起查询确认订单状态未支付(或者支付中)后发起撤销。 <code>如果招联侧原交易状态成功,该接口功能同退款接口,但还是建议使用退款接口</code>
<code>注意:</code>成功交易调用此接口会退款,请对接合作方、商户等接口调用方谨慎调用,尤其在定时任务、预期自动跑批等场景。
建议:原交易请求完至少<code>15S</code>后发起撤销。
目前仅支持撤销<code>当日</code>交易。</p>
<p><strong>请求示例</strong>:</p>
<pre><code class="language-javascript">{
&quot;cancelOrderNo&quot;: &quot;2023032515294222446445&quot;,
&quot;fyTermId&quot;: &quot;&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: &quot;2023032715294222446445&quot;,
&quot;appId&quot;: &quot;MCH_A698612520&quot;,
&quot;operatorId&quot;: &quot;&quot;,
&quot;sign&quot;: &quot;4ba5d2540cb2f64025a25841f1384ab0&quot;,
&quot;termId&quot;: &quot;12345678&quot;,
&quot;wayCode&quot;: &quot;WECHAT&quot;
}</code></pre>
<p><strong>请求参数</strong>:</p>
<table>
<thead>
<tr>
<th>参数名称</th>
<th>参数说明</th>
<th>请求类型</th>
<th>是否必须</th>
<th>数据类型</th>
<th>schema</th>
</tr>
</thead>
<tbody>
<tr>
<td>req</td>
<td>req</td>
<td>body</td>
<td>订单撤销请求实体</td>
<td>订单撤销请求实体</td>
</tr>
<tr>
<td>&emsp;&emsp;version</td>
<td>版本号</td>
<td>false</td>
<td>string</td>
<td>默认1.0</td>
</tr>
<tr>
<td>&emsp;&emsp;sign</td>
<td>签名值</td>
<td><code>true</code></td>
<td>string</td>
<td>详见签名生成算法</td>
</tr>
<tr>
<td>&emsp;&emsp;termId</td>
<td>终端id</td>
<td><code>true</code></td>
<td>string</td>
<td>没有真实终端号统一填88888888</td>
</tr>
<tr>
<td>&emsp;&emsp;mchNo</td>
<td>商户号</td>
<td><code>true</code></td>
<td>string</td>
<td>招联分配给二级商户的商户号</td>
</tr>
<tr>
<td>&emsp;&emsp;appId</td>
<td>应用id</td>
<td><code>true</code></td>
<td>string</td>
<td>商户配置的应用id</td>
</tr>
<tr>
<td>&emsp;&emsp;mchOrderNo</td>
<td>商户订单号</td>
<td><code>true</code></td>
<td>string</td>
<td>商户系统内部的订单号(5到30个字符、 只能包含字母数字下划线,区分大小写)</td>
</tr>
<tr>
<td>&emsp;&emsp;wayCode</td>
<td>支付方式</td>
<td>false</td>
<td>string</td>
<td>ALIPAY(条码支付) WECHAT(条码支付)</td>
</tr>
<tr>
<td>&emsp;&emsp;cancelOrderNo</td>
<td>商户撤销单号</td>
<td><code>true</code></td>
<td>string</td>
<td>原交易订单号</td>
</tr>
<tr>
<td>&emsp;&emsp;operatorId</td>
<td>操作员</td>
<td>false</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;fyTermId</td>
<td>富友终端号</td>
<td>false</td>
<td>string</td>
<td>富友终端号</td>
</tr>
</tbody>
</table>
<p><strong>响应状态</strong>:</p>
<table>
<thead>
<tr>
<th>状态码</th>
<th>说明</th>
<th>schema</th>
</tr>
</thead>
<tbody>
<tr>
<td>200</td>
<td>OK</td>
<td>R«订单撤销返回实体»</td>
</tr>
</tbody>
</table>
<p>>见[应答码表](<a href="https://www.showdoc.com.cn/jucaishangfu/9966099368299628">https://www.showdoc.com.cn/jucaishangfu/9966099368299628</a> "应答码表")</p>
<p><strong>响应参数</strong>:</p>
<table>
<thead>
<tr>
<th>参数名称</th>
<th>参数说明</th>
<th>类型</th>
<th>schema</th>
</tr>
</thead>
<tbody>
<tr>
<td>code</td>
<td>integer(int32)</td>
<td>integer(int32)</td>
</tr>
<tr>
<td>data</td>
<td>订单撤销返回实体</td>
<td>订单撤销返回实体</td>
</tr>
<tr>
<td>&emsp;&emsp;cancelId</td>
<td>渠道撤销流水号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;cancelOrderNo</td>
<td>商户撤销单号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;dealDate</td>
<td>交易日期</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;fundChange</td>
<td>是否有资金流向(只有支付宝有该字段)</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;orgId</td>
<td>机构号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;mchNo</td>
<td>商户号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;mchOrderNo</td>
<td>商户订单号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;randomStr</td>
<td>随机字符串</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;recall</td>
<td>是否需要新调用撤销(当为Y时,需要重新调用撤销接口)</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;termId</td>
<td>终端号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;traceNo</td>
<td>系统内部追踪号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;transactionId</td>
<td>渠道交易流水号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;wayCode</td>
<td>订单类型</td>
<td>string</td>
</tr>
<tr>
<td>msg</td>
<td>string</td>
</tr>
<tr>
<td>sign</td>
<td>string</td>
</tr>
</tbody>
</table>
<p><strong>响应示例</strong>:</p>
<pre><code class="language-javascript">{
&quot;code&quot;: 200,
&quot;msg&quot;: &quot;订单已撤销&quot;,
&quot;data&quot;: {
&quot;returnCode&quot;: &quot;000000&quot;,
&quot;returnMsg&quot;: &quot;SUCCESS&quot;,
&quot;cancelId&quot;: &quot;&quot;,
&quot;cancelOrderNo&quot;: &quot;2023032715410800368877&quot;,
&quot;dealDate&quot;: &quot;&quot;,
&quot;fundChange&quot;: &quot;&quot;,
&quot;orgId&quot;: &quot;ISV_I238002400&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: &quot;2023032515402317114302&quot;,
&quot;randomStr&quot;: &quot;YJ50AF72CWIMFH7MIS7D9K60MGTOW7Z7&quot;,
&quot;recall&quot;: &quot;&quot;,
&quot;termId&quot;: &quot;&quot;,
&quot;traceNo&quot;: &quot;&quot;,
&quot;transactionId&quot;: &quot;&quot;,
&quot;wayCode&quot;: &quot;WECHAT&quot;
},
&quot;sign&quot;: &quot;d374750034a8f9e74a86301decaa7d56&quot;
}</code></pre>