代扣预签约
商户可调用本接口预先指定签约信息,生成预签约跳转参数,然后跳转至微信支付的页面。
请求参数 | 类型 | 描述 |
---|---|---|
json | object | 声明请求的JSON 数据结构 |
sign_scene | string | 签约场景SIGN_SCENE_APP | SIGN_SCENE_QRCODE 枚举值之一 |
appid | string | 应用ID |
openid | string | 用户在直连商户应用下的用户标示 |
plan_id | number | 委托代扣模板ID |
out_contract_code | string | 商户签约协议号 |
contract_display_account | string | 用户账户展示名称 |
contract_notify_url | string | 签约结果通知地址 |
out_user_code | string | 商户侧用户标识 |
return_url | string | 回跳地址的url |
device_info | object | 发起预签约的用户,其设备信息 |
device_type | string | 设备类型DEVICE_TYPE_UNKNOW | DEVICE_TYPE_PHONE | DEVICE_TYPE_PAD | DEVICE_TYPE_TV | DEVICE_TYPE_WATCH 枚举值之一 |
device_os | string | 设备的OS版本 |
device_id | string | 设备ID |
device_running_as_root | boolean | 设备是否以root身份运行 |
device_ip | string | 设备的IP |
weixin_installed | boolean | 设备上是否安装微信 |
weixin_version | string | 设备上微信的版本 |
days_since_first_login | string | 发起预签约的用户首次登录该设备的时间DAYS_SINCE_FIRST_LOGIN_UNKNOW | DAYS_SINCE_FIRST_LOGIN_WITHIN_1_DAY | DAYS_SINCE_FIRST_LOGIN_WITHIN_7_DAYS | DAYS_SINCE_FIRST_LOGIN_WITHIN_30_DAYS | DAYS_SINCE_FIRST_LOGIN_WITHIN_90_DAYS | DAYS_SINCE_FIRST_LOGIN_WITHIN_180_DAYS | DAYS_SINCE_FIRST_LOGIN_MORE_THEN_180_DAYS 枚举值之一 |
php
$instance->v3->papay->entrustSign->contracts->preEntrustSign->postAsync([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/papay/entrust-sign/contracts/pre-entrust-sign')->postAsync([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/papay/entrust-sign/contracts/pre-entrust-sign']->postAsync([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->papay->entrustSign->contracts->preEntrustSign->post([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/papay/entrust-sign/contracts/pre-entrust-sign')->post([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/papay/entrust-sign/contracts/pre-entrust-sign']->post([
'json' => [
'sign_scene' => 'SIGN_SCENE_APP',
'appid' => 'wxd678efh567hg6787',
'openid' => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
'plan_id' => 12535,
'out_contract_code' => 'wxwtdk20200910100000',
'contract_display_account' => '微信代扣用户A',
'contract_notify_url' => 'https://yourapp.com/notify',
'out_user_code' => '用户A',
'return_url' => 'https://yourapp.com/notify',
'device_info' => [
'device_type' => 'DEVICE_TYPE_UNKNOW',
'device_os' => 'example_device_os',
'device_id' => 'example_device_id',
'device_running_as_root' => true,
'device_ip' => 'example_device_ip',
'weixin_installed' => true,
'weixin_version' => 'example_weixin_version',
'days_since_first_login' => 'DAYS_SINCE_FIRST_LOGIN_UNKNOW',
],
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
pre_entrustweb_id | string | 预签约ID |
mini_program_username | string | 跳转签约小程序的username |
mini_program_path | string | 跳转签约小程序的path |
redirect_url | string | 展示扫码签约的二维码的URL |
参阅 官方文档