APP纯签约
外部App拉起微信客户端发起签约前,需先后台调用预签约接口完成预签约,获取pre_entrustweb_id,再拉起微信客户端,完成签约,返回App。
请求参数 | 类型 | 描述 |
---|---|---|
nonceless | true | 声明请求的XML 无随机字符串参数 |
xml | object | 声明请求的XML 数据结构 |
appid | string | 应用ID |
mch_id | string | 商户号 |
sub_appid | string | 子商户应用ID |
sub_mch_id | string | 子商户号 |
plan_id | string | 模板id |
contract_code | string | 签约协议号 |
request_serial | integer | 请求序列号 |
contract_display_account | string | 用户账户展示名称 |
notify_url | string | 回调通知url |
version | string | 版本号1.0 枚举值 |
sign_type | string | 签名类型MD5 | HMAC-SHA256 枚举值之一 |
timestamp | string | 时间戳 |
return_app | string | 返回appY | 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_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
return_msg | string | 返回信息 |
result_code | string | 业务结果SUCCESS | FAIL 枚举值之一 |
err_code | string | 错误代码 |
err_code_des | string | 错误代码描述 |
appid | string | 请求appid |
mch_id | string | 商户号 |
nonce_str | string | 随机字符串 |
sign | string | 签名 |
pre_entrustweb_id | string | 预签约id |
参阅 官方文档