1.6 历史订单查询
<h2>历史订单查询</h2>
<p><strong>接口地址</strong>:<code>/pay/api/1.0/queryHistoryOrder</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>:
本接口提供给商户查询历史交易记录。查询实时交易状态、结果(当前交易)须使用[1.5订单查询](<a href="https://www.showdoc.com.cn/jucaishangfu/9965825766680565">https://www.showdoc.com.cn/jucaishangfu/9965825766680565</a> "1.5订单查询")</p>
<p><strong>请求示例</strong>:</p>
<pre><code class="language-javascript">{
&quot;appId&quot;: &quot;MCH_A698612520&quot;,
&quot;channelOrderId&quot;: &quot;&quot;,
&quot;dealDate&quot;: &quot;&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: &quot;2023032715294222446555&quot;,
&quot;sign&quot;: &quot;81bc10f686e541f4566f33945ac4fafc&quot;,
&quot;termId&quot;: &quot;12345678&quot;,
&quot;transactionId&quot;: &quot;&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>true</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>true</td>
<td>string</td>
<td>详见签名生成算法</td>
</tr>
<tr>
<td>&emsp;&emsp;termId</td>
<td>终端id</td>
<td>true</td>
<td>string</td>
<td>没有真实终端号统一填88888888</td>
</tr>
<tr>
<td>&emsp;&emsp;mchNo</td>
<td>商户号</td>
<td>true</td>
<td>string</td>
<td>招联分配给二级商户的商户号</td>
</tr>
<tr>
<td>&emsp;&emsp;appId</td>
<td>应用id</td>
<td>true</td>
<td>string</td>
<td>商户配置的应用id</td>
</tr>
<tr>
<td>&emsp;&emsp;mchOrderNo</td>
<td>商户订单号</td>
<td>true</td>
<td>string</td>
<td>商户订单号, 商户系统内部的订单号(5到30个字符、 只能包含字母数字下划线,区分大小写)</td>
</tr>
<tr>
<td>&emsp;&emsp;wayCode</td>
<td>支付方式</td>
<td>true</td>
<td>string</td>
<td>ALIPAY(统一下单、条码支付、服务窗支付)<br> WECHAT(统一下单、条码支付、公众号支付)<br> UNIONPAY(银联)<br> WXAPP(微信app)<br> ALIAPP(支付宝app)<br> WXH5(微信h5)<br> ALIH5(支付宝h5)</td>
</tr>
<tr>
<td>&emsp;&emsp;dealDate</td>
<td>交易日期格式yyyyMMdd</td>
<td>false</td>
<td>string</td>
<td>非必填,默认当天。 查询往日交易时,必填</td>
</tr>
<tr>
<td>&emsp;&emsp;channelOrderId</td>
<td>条码流水</td>
<td>false</td>
<td>string</td>
<td>线下支付,条码流水号</td>
</tr>
<tr>
<td>&emsp;&emsp;transactionId</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;amount</td>
<td>订单金额(分)</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;buyerId</td>
<td>买家在渠道(微信、支付宝)的用户ID</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;buyerLogonId</td>
<td>买家在渠道登录账号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;channelOrderId</td>
<td>条码流水号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;couponFee</td>
<td>优惠金额(分)</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;dealDate</td>
<td>交易日期</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;extParam</td>
<td>附加数据</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;fundBillList</td>
<td>支付宝交易资金渠道</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;fyTermId</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;termId</td>
<td>终端号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;traceNo</td>
<td>系统内部追踪号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;transStat</td>
<td>交易状态</td>
<td>string</td>
<td>SUCCESS 成功<br>PAYERROR 失败 USERPAYING支付中 NOTPAY 未支付<br> CLOSED 已关闭<br> REVOKED 已撤销<br> REFUND 已退款</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;amount&quot;: &quot;1&quot;,
&quot;buyerId&quot;: &quot;oUpF8uDQU2VTS1pmCQbWT8fcOP64&quot;,
&quot;buyerLogonId&quot;: &quot;&quot;,
&quot;channelOrderId&quot;: &quot;2023032711285487257295&quot;,
&quot;couponFee&quot;: &quot;&quot;,
&quot;dealDate&quot;: &quot;20230327&quot;,
&quot;extParam&quot;: &quot;&quot;,
&quot;fundBillList&quot;: &quot;&quot;,
&quot;fyTermId&quot;: &quot;&quot;,
&quot;orgId&quot;: &quot;ISV_I238002400&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: &quot;2023032711285487257295&quot;,
&quot;randomStr&quot;: &quot;XMDSWZMRXAOIQ5WESLP7CB6J2LTI2EWA&quot;,
&quot;termId&quot;: &quot;&quot;,
&quot;traceNo&quot;: &quot;100063825452&quot;,
&quot;transStat&quot;: &quot;REFUND&quot;,
&quot;transactionId&quot;: &quot;4200000700202010090766639303&quot;,
&quot;wayCode&quot;: &quot;WECHAT&quot;
},
&quot;sign&quot;: &quot;1ac527b52dcb1638bb92c10bfccbd5d3&quot;
}</code></pre>