1.10 微信授权码查询openid - 银联授权码获取user_id
<p><strong>接口地址</strong>:<code>/pay/api/1.0/auth2OpenId</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>该接口常应用于聚合二维码(静态二维码、统一收款码、台卡等不同叫法,需合作方自己使用H5页面地址生成二维码),用户扫二维码进入微信公众号/支付宝服务窗/QQJS 页面,页面调此接口生成订单,接受订单参数后调起官方支付接口支付。详见公众号/服务窗对接流程</p></p>
<p><strong>请求示例</strong>:</p>
<pre><code class="language-javascript">{
&quot;appId&quot;: &quot;MCH_A698612520&quot;,
&quot;authCode&quot;: &quot;134291427096188722&quot;,
&quot;clientIp&quot;: &quot;127.0.0.1&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: &quot;2023041709270000001&quot;,
&quot;sign&quot;: &quot;d012419a8968d6e9e000bc557e72f4bd&quot;,
&quot;subAppid&quot;: &quot;&quot;,
&quot;termId&quot;: &quot;12345678&quot;,
&quot;version&quot;: &quot;1.0&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>微信授权码查询openid / 银联授权码获取user_id请求实体</td>
<td>微信授权码查询openid / 银联授权码获取user_id请求实体</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>微信:WECHAT<br>银联:UNIONPAY</td>
</tr>
<tr>
<td>&emsp;&emsp;authCode</td>
<td>扫码支付授权码</td>
<td>true</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;clientIp</td>
<td>实时交易终端IP地址</td>
<td>true</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;subAppid</td>
<td>1、微信:微信分配的子商户公众账号ID<br> 2、银联:填空或填固定值: UnionPay/1.0 CloudPay</td>
<td>false</td>
<td>string</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>微信授权码查询openid / 银联授权码获取user_id返回实体</td>
<td>微信授权码查询openid / 银联授权码获取user_id返回实体</td>
</tr>
<tr>
<td>&emsp;&emsp;appid</td>
<td>微信分配的公众账号ID</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;openid</td>
<td>用户在商户appid下的唯一标识</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;orgId</td>
<td>机构号</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;randomStr</td>
<td>随机字符串</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;subAppid</td>
<td>微信分配的子商户公众账号ID</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;subOpenid</td>
<td>用户在子商户appid下的唯一标识</td>
<td>string</td>
</tr>
<tr>
<td>&emsp;&emsp;termId</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;termId&quot;: null,
&quot;randomStr&quot;: &quot;58H6XIKWXXNUVDVP9IZWX1NAQ8U6HUWD&quot;,
&quot;orgId&quot;: &quot;ISV_I232767463&quot;,
&quot;mchNo&quot;: &quot;MCH_I293975931&quot;,
&quot;mchOrderNo&quot;: null,
&quot;appid&quot;: &quot;wxfaxxxx&quot;,
&quot;openid&quot;: &quot;ooIeqs3PCR04Hkvd-xxxx&quot;,
&quot;subAppid&quot;: &quot;&quot;,
&quot;subOpenid&quot;: &quot;&quot;
},
&quot;sign&quot;: &quot;046d401cda399814f5b5d88cf9bd5e74&quot;
}</code></pre>