Skip to content

微信支付实名验证

取得token后调用本接口验证微信用户的姓名和身份证信息是否匹配

🔐

本接口服务已于 2021.11.10 (北京时间)停止开放,文档仅做留存参考。

请求参数类型描述
base_uristring声明接入点
固定值https://fraud.mch.weixin.qq.com/
xmlobject声明请求的XML数据结构
versionstring接口版本号
1.0 | 1.1 枚举值之一
mch_idstring商户号
appidstring公众账号ID
openidstring用户标识
real_namestring真实姓名
cred_typenumber证件类型
1 | 2 | 5 | 9 | 12 | 17 | 18 枚举值之一
cred_idstring证件号码
access_tokenstring步骤2或步骤3获取到的access_token
sign_typestring签名类型
HMAC-SHA256 | MD5 枚举值之一
php
$instance->v2->secsvc->realnameauth->postAsync([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/secsvc/realnameauth')->postAsync([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/secsvc/realnameauth']->postAsync([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->secsvc->realnameauth->post([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/secsvc/realnameauth')->post([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/secsvc/realnameauth']->post([
  'base_uri' => 'https://fraud.mch.weixin.qq.com/', // 接入点
  'xml' => [
    'version'      => '1.0',
    'mch_id'       => '1900000109',
    'appid'        => 'wx2421b1c4370ec43b',
    'openid'       => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'    => '刘某某',
    'cred_type'    => '1',
    'cred_id'      => '440000000000000000',
    'access_token' => '81_...',
    'sign_type'    => 'HMAC-SHA256',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring错误码描述
error_codestring错误码
error_code_desstring错误代码描述
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
appidstring公众账号ID
mch_idstring商户号
nonce_strstring随机字符串
openidstring用户标识
access_tokenstring步骤2或步骤3获取到的access_token
verify_openidstring有多个结果时用分号”;”连接
V_OP_NA | V_OP_NM_MA | V_OP_NM_UM 枚举值之一
verify_real_namestring当verify_openid为V_OP_NM_MA时返回
V_NM_ID_MA | V_NM_ID_UM | V_NM_ID_TYPE_UM 枚举值之一
bind_bankcardstring当verify_real_name为V_NM_ID_MA时返回
YES | NO 枚举值之一

参阅 官方文档

Published on the GitHub by TheNorthMemory