Skip to content

小程序场景预签约(需要实名验证)

商户可调用本接口预先指定签约,生成预签约会话及对应的预签约ID,再携带预签约ID(pre_entrustweb_id)参数,通过微信SDK拉起微信支付客户端的签约页面。通过本接口预签约时,商户需具备实名验证产品权限,要求用户在签约时完成实名验证授权,仅当用户的微信支付实名信息与商户预留一致时才能完成签约。

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring签约和付款的AppID
out_contract_codestring业务申请单号
openidstring个人收款方的OpenID
real_namestring真实姓名
cred_typestring证件类型
ID_CARD 枚举值
cred_idstring件号码
headersobject声明请求的头参数
Wechatpay-Serialstring微信支付公钥ID/平台证书序列号
php
$instance->v3->ecommerce->individualContracts->preEntrustSignWithRealNameIdentity->miniProgram->postAsync([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/ecommerce/individual-contracts/pre-entrust-sign-with-real-name-identity/mini-program')->postAsync([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/ecommerce/individual-contracts/pre-entrust-sign-with-real-name-identity/mini-program']->postAsync([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->ecommerce->individualContracts->preEntrustSignWithRealNameIdentity->miniProgram->post([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/ecommerce/individual-contracts/pre-entrust-sign-with-real-name-identity/mini-program')->post([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/ecommerce/individual-contracts/pre-entrust-sign-with-real-name-identity/mini-program']->post([
  'json' => [
    'appid'             => 'wxd678efh567h23787',
    'out_contract_code' => 'APPLYMENT_00000000001',
    'openid'            => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'real_name'         => 'pVd1HJ6zyvPedzGaV+X3qtmrq9bb9tP',
    'cred_type'         => 'ID_CARD',
    'cred_id'           => 'MZnwEx6zotwIz6ctW2/iQL5z9',
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
pre_entrustweb_idstring预签约id

参阅 官方文档

Published on the GitHub by TheNorthMemory