Skip to content

APP纯签约

外部App拉起微信客户端发起签约前,需先后台调用预签约接口完成预签约,获取pre_entrustweb_id,再拉起微信客户端,完成签约,返回App。

请求参数类型描述
noncelesstrue声明请求的XML无随机字符串参数
xmlobject声明请求的XML数据结构
appidstring应用ID
mch_idstring商户号
sub_appidstring子商户应用ID
sub_mch_idstring子商户号
plan_idstring模板id
contract_codestring签约协议号
request_serialinteger请求序列号
contract_display_accountstring用户账户展示名称
notify_urlstring回调通知url
versionstring版本号
1.0 枚举值
sign_typestring签名类型
MD5 | HMAC-SHA256 枚举值之一
timestampstring时间戳
return_appstring返回app
Y | N 枚举值之一
php
$instance->v2->papay->preentrustweb->postAsync([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/papay/preentrustweb')->postAsync([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/papay/preentrustweb']->postAsync([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->papay->preentrustweb->post([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/papay/preentrustweb')->post([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/papay/preentrustweb']->post([
  'nonceless' => true,
  'xml' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'sub_appid'                => 'wxcbda96de0b165489',
    'sub_mch_id'               => '1900000109',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => '',
    'version'                  => '1.0',
    'sign_type'                => 'MD5',
    'timestamp'                => '1414488825',
    'return_app'               => 'Y',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
appidstring请求appid
mch_idstring商户号
nonce_strstring随机字符串
signstring签名
pre_entrustweb_idstring预签约id

参阅 官方文档

Published on the GitHub by TheNorthMemory