授权码查询openid
通过授权码查询公众号Openid,调用查询后,该授权码只能由此商户号发起扣款,直至授权码更新。
| 请求参数 | 类型 | 描述 |
|---|---|---|
| xml | object | 声明请求的XML数据结构 |
| appid | string | 公众账号ID |
| mch_id | string | 商户号 |
| sub_appid | string | 子商户公众账号ID |
| sub_mch_id | string | 子商户号 |
| auth_code | string | 授权码 |
php
$instance->v2->tools->authcodetoopenid->postAsync([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();php
$instance->chain('v2/tools/authcodetoopenid')->postAsync([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();php
$instance['v2/tools/authcodetoopenid']->postAsync([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();php
$response = $instance->v2->tools->authcodetoopenid->post([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));php
$response = $instance->chain('v2/tools/authcodetoopenid')->post([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));php
$response = $instance['v2/tools/authcodetoopenid']->post([
'xml' => [
'appid' => '',
'mch_id' => '',
'sub_appid' => '',
'sub_mch_id' => '',
'auth_code' => '',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));| 返回字典 | 类型 | 描述 |
|---|---|---|
| sub_appid | string | 子商户公众账号ID |
| sub_mch_id | string | 子商户号 |
| sub_openid | string | 用户子标识 |
| return_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
| return_msg | string | 返回信息 |
| appid | string | 公众账号ID |
| mch_id | string | 商户号 |
| nonce_str | string | 随机字符串 |
| sign | string | 签名 |
| result_code | string | 业务结果SUCCESS | FAIL 枚举值之一 |
| err_code | string | 错误代码 |
| openid | string | 用户标识 |