Skip to content

保险商户H5预签约

商户可调用本接口预先指定签约及交易信息(交易信息可选填),生成预签约会话及对应的跳转URL,引导用户在原浏览器中请求该URL,将跳转至用户微信支付客户端的签约页面。

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring应用ID
openidstring用户在直连商户应用下的用户标示
plan_idnumber委托代扣模板ID
out_contract_codestring商户签约协议号
insured_display_namestring被保人的展示名称
contract_notify_urlstring签约结果通知地址
policy_start_datestring保险保单的开始日期
policy_end_datestring保险保单的结束日期
policy_periodsobject[]保单的扣费周期列表
policy_period_idnumber保险扣费周期编号
estimated_deduct_datestring预计扣费的日期
estimated_deduct_amountobject预计扣费金额
totalnumber金额
currencystring货币类型
amountobject扣费金额信息
totalnumber金额
currencystring货币类型
out_trade_nostring商户订单号
descriptionstring商品描述
transaction_notify_urlstring支付结果通知地址
out_user_codestring商户侧用户标识
goods_tagstring订单优惠标记
attachstring附加数据
can_auto_insureboolean是否自动续保
can_auto_reinsureboolean是否自动重新投保
real_identityobject用户实名信息
real_namestring自然人姓名
id_card_numberstring自然人身份证号码
identity_typestring实名验证类型
jump_controlobject跳转控制信息
jump_appidstring跳转的应用AppID
combined_deduct_period_countnumber合并扣费期数
headersobject声明请求的头参数
Wechatpay-Serialstring微信支付平台证书序列号
php
$instance->v3->papay->insuranceSign->contracts->preEntrustSign->h5->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
])
->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/h5')->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
])
->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/h5']->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
])
->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->h5->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/papay/insurance-sign/contracts/pre-entrust-sign/h5')->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/papay/insurance-sign/contracts/pre-entrust-sign/h5']->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',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
    'combined_deduct_period_count' => 1,
  ],
  'headers' => [
    'Wechatpay-Serial' => '',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
redirect_urlstring拉起微信支付客户端的URL

参阅 官方文档

Published on the GitHub by TheNorthMemory