Skip to content

预签约

商户通过调用该接口可获取预签约号(“presign_token”),预签约号对应用户一次的签约信息,之后用户可以从商户小程序跳转到微信签约小程序时使用该预签约号进行签约

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring服务商APPID
sub_mchidstring子商户号
sub_appidstring子商户APPID
openidstring服务商APPID下的用户标识
sub_openidstring子商户APPID下的用户标识
plan_idstring签约模板号
user_idstring用户账号
period_start_datestring首次扣款日期
trade_scenestring场景信息枚举
php
$instance->v3->eduPapay->contracts->presign->postAsync([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/edu-papay/contracts/presign')->postAsync([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/edu-papay/contracts/presign']->postAsync([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->eduPapay->contracts->presign->post([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/edu-papay/contracts/presign')->post([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/edu-papay/contracts/presign']->post([
  'json' => [
    'appid' => 'wx8888888888888888',
    'sub_mchid' => '1900000109',
    'sub_appid' => 'wx8888888888888888',
    'openid' => 'oUpF8uMuAJOM2pxb1Q',
    'sub_openid' => 'oUpF8uMuAJOM2pxb2W',
    'plan_id' => '101164396123311331',
    'user_id' => '20200330tony',
    'period_start_date' => '2020-03-19',
    'trade_scene' => 'EDUCATION_PERIOD',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
presign_tokenstring预签约号

参阅 官方文档

Published on the GitHub by TheNorthMemory