Skip to content

代扣预签约

商户可调用本接口预先指定签约信息,生成预签约跳转参数,然后跳转至微信支付的页面。

请求参数类型描述
jsonobject声明请求的JSON数据结构
sign_scenestring签约场景
SIGN_SCENE_APP | SIGN_SCENE_QRCODE 枚举值之一
appidstring应用ID
openidstring用户在直连商户应用下的用户标示
plan_idnumber委托代扣模板ID
out_contract_codestring商户签约协议号
contract_display_accountstring用户账户展示名称
contract_notify_urlstring签约结果通知地址
out_user_codestring商户侧用户标识
return_urlstring回跳地址的url
device_infoobject发起预签约的用户,其设备信息
device_typestring设备类型
DEVICE_TYPE_UNKNOW | DEVICE_TYPE_PHONE | DEVICE_TYPE_PAD | DEVICE_TYPE_TV | DEVICE_TYPE_WATCH 枚举值之一
device_osstring设备的OS版本
device_idstring设备ID
device_running_as_rootboolean设备是否以root身份运行
device_ipstring设备的IP
weixin_installedboolean设备上是否安装微信
weixin_versionstring设备上微信的版本
days_since_first_loginstring发起预签约的用户首次登录该设备的时间
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_idstring预签约ID
mini_program_usernamestring跳转签约小程序的username
mini_program_pathstring跳转签约小程序的path
redirect_urlstring展示扫码签约的二维码的URL

参阅 官方文档

Published on the GitHub by TheNorthMemory