Skip to content

H5场景预约扣费类型签约的预签约

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

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring应用ID
openidstring用户在直连商户应用下的用户标示
plan_idnumber委托代扣模板ID
out_contract_codestring商户签约协议号
contract_display_accountstring用户账户展示名称
contract_notify_urlstring签约结果通知地址
out_user_codestring商户侧用户标识
deduct_scheduleobject用于预约扣费的预约信息
estimated_deduct_datestring预计扣费的日期
estimated_deduct_amountobject预计的扣费金额
totalnumber金额
currencystring货币类型
descriptionstring商品描述
jump_controlobject跳转控制信息
jump_appidstring跳转的应用AppID
php
$instance->v3->papay->scheduledDeductSign->contracts->preEntrustSign->h5->postAsync([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/papay/scheduled-deduct-sign/contracts/pre-entrust-sign/h5')->postAsync([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/papay/scheduled-deduct-sign/contracts/pre-entrust-sign/h5']->postAsync([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->papay->scheduledDeductSign->contracts->preEntrustSign->h5->post([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/papay/scheduled-deduct-sign/contracts/pre-entrust-sign/h5')->post([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/papay/scheduled-deduct-sign/contracts/pre-entrust-sign/h5']->post([
  'json' => [
    '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',
    'deduct_schedule' => [
      'estimated_deduct_date' => '2019-11-22',
      'estimated_deduct_amount' => [
        'total' => 1,
        'currency' => 'CNY',
      ],
      'description' => '小乔-碎云皮肤(微信83区沧海之耀)',
    ],
    'jump_control' => [
      'jump_appid' => 'wxd678efh567hg6787',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
redirect_urlstring拉起微信支付客户端的URL

参阅 官方文档

Published on the GitHub by TheNorthMemory