保险商户小程序预签约 
商户可调用本接口预先指定签约及交易信息(交易信息可选填),生成预签约会话及对应的预签约ID,再携带预签约ID(pre_entrustweb_id)参数,通过小程序跳转参数调用navigateToMiniProgram跳转至微信支付的页面。
| 请求参数 | 类型 | 描述 | 
|---|---|---|
| json | object | 声明请求的JSON数据结构 | 
| appid | string | 应用ID | 
| openid | string | 用户在直连商户应用下的用户标示 | 
| plan_id | number | 委托代扣模板ID | 
| out_contract_code | string | 商户签约协议号 | 
| insured_display_name | string | 被保人的展示名称 | 
| contract_notify_url | string | 签约结果通知地址 | 
| policy_start_date | string | 保险保单的开始日期 | 
| policy_end_date | string | 保险保单的结束日期 | 
| policy_periods | object[] | 保单的扣费周期列表 | 
| policy_period_id | number | 保险扣费周期编号 | 
| estimated_deduct_date | string | 预计扣费的日期 | 
| estimated_deduct_amount | object | 预计扣费金额 | 
| total | number | 金额 | 
| currency | string | 货币类型 | 
| amount | object | 扣费金额信息 | 
| total | number | 金额 | 
| currency | string | 货币类型 | 
| out_trade_no | string | 商户订单号 | 
| description | string | 商品描述 | 
| transaction_notify_url | string | 支付结果通知地址 | 
| out_user_code | string | 商户侧用户标识 | 
| goods_tag | string | 订单优惠标记 | 
| attach | string | 附加数据 | 
| can_auto_insure | boolean | 是否自动续保 | 
| can_auto_reinsure | boolean | 是否自动重新投保 | 
| real_identity | object | 用户实名信息 | 
| real_name | string | 自然人姓名 | 
| id_card_number | string | 自然人身份证号码 | 
| identity_type | string | 实名验证类型ID_CARD 枚举值 | 
| combined_deduct_period_count | number | 合并扣费期数 | 
| headers | object | 声明请求的头参数 | 
| Wechatpay-Serial | string | 微信支付公钥ID/平台证书序列号 | 
php
$instance->v3->papay->insuranceSign->contracts->preEntrustSign->miniProgram->postAsync([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance->chain('v3/papay/insurance-sign/contracts/pre-entrust-sign/mini-program')->postAsync([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$instance['v3/papay/insurance-sign/contracts/pre-entrust-sign/mini-program']->postAsync([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();php
$response = $instance->v3->papay->insuranceSign->contracts->preEntrustSign->miniProgram->post([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance->chain('v3/papay/insurance-sign/contracts/pre-entrust-sign/mini-program')->post([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));php
$response = $instance['v3/papay/insurance-sign/contracts/pre-entrust-sign/mini-program']->post([
  'json' => [
    'appid'                        => 'wxd678efh567hg6787',
    'openid'                       => 'oYobu0MVnQfWpSMOYJz2AHPG_gQw',
    'plan_id'                      => 12535,
    'out_contract_code'            => 'wxwtdk20200910100000',
    'insured_display_name'         => '*明',
    'contract_notify_url'          => 'https://yourapp.com/notify',
    'policy_start_date'            => '2019-11-22',
    'policy_end_date'              => '2020-11-22',
    'policy_periods'               => [[
      'policy_period_id'        => 1,
      'estimated_deduct_date'   => '2019-11-22',
      'estimated_deduct_amount' => [
        'total'    => 1,
        'currency' => 'CNY',
      ],
    ],],
    'amount'                       => [
      'total'    => 1,
      'currency' => 'CNY',
    ],
    'out_trade_no'                 => '1217752501201407033233368018',
    'description'                  => 'Image形象店-深圳腾大-QQ公仔',
    'transaction_notify_url'       => 'https://www.qq.com/',
    'out_user_code'                => '用户昵称',
    'goods_tag'                    => 'DISCOUNTS',
    'attach'                       => '自定义数据',
    'can_auto_insure'              => true,
    'can_auto_reinsure'            => true,
    'real_identity'                => [
      'real_name'      => 'OEimkKuua8igpd+0YDgqF2Z61leeGD7x87j3Ph==',
      'id_card_number' => '1axtI9EZUr0343c89xQznxau+cRWPKP4YhVAoj==',
      'identity_type'  => 'ID_CARD',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => 'PUB_KEY_ID_0114232134912410000000000000',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));| 返回字典 | 类型 | 描述 | 
|---|---|---|
| pre_entrustweb_id | string | 预签约ID | 
| redirect_appid | string | 跳转签约小程序的AppID | 
| redirect_path | string | 跳转签约小程序的路径 |