Skip to content

授权码查询openid

通过授权码查询公众号Openid,调用查询后,该授权码只能由此商户号发起扣款,直至授权码更新。

请求参数类型描述
xmlobject声明请求的XML数据结构
appidstring公众账号ID
mch_idstring商户号
sub_appidstring子商户公众账号ID
sub_mch_idstring子商户号
auth_codestring授权码
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_appidstring子商户公众账号ID
sub_mch_idstring子商户号
sub_openidstring用户子标识
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号ID
mch_idstring商户号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
openidstring用户标识

参阅 官方服务商付款码文档

Published on the GitHub by TheNorthMemory