Skip to content

H5纯签约

该方式适用于手机、平板电脑等使用H5浏览器的设备场景使用微信签约扣款。商户在网站前端通过微信支付H5纯签约接口与用户签订委托扣款协议,再通过后台接口申请扣款来完成代扣交易。

请求参数类型描述
queryobject声明请求的查询参数
appidstring应用ID
mch_idstring商户号
plan_idstring模板id
contract_codestring签约协议号
request_serialinteger请求序列号
contract_display_accountstring用户账户展示名称
notify_urlstring回调通知url
versionstring版本号
1.0 枚举值
signstring签名
sign_typestring签名类型
MD5 | HMAC-SHA256 枚举值之一
timestampstring时间戳
return_appidstring回调应用appid
php
$instance->v2->papay->h5entrustweb->getAsync([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/papay/h5entrustweb')->getAsync([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/papay/h5entrustweb']->getAsync([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->papay->h5entrustweb->get([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/papay/h5entrustweb')->get([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/papay/h5entrustweb']->get([
  'query' => [
    'appid'                    => 'wxcbda96de0b165486',
    'mch_id'                   => '1200009811',
    'plan_id'                  => '12535',
    'contract_code'            => '100000',
    'request_serial'           => '1000',
    'contract_display_account' => '微信代扣',
    'notify_url'               => 'https://weixin.qq.com',
    'version'                  => '1.0',
    'sign'                     => 'C380BEC2BFD727A4B6845133519F3AD6',
    'timestamp'                => '1414488825',
    'clientip'                 => '119.145.83.6',
    'deviceid'                 => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'mobile'                   => '18933432355',
    'email'                    => 'aobama@whitehouse.com',
    'qq'                       => '100243',
    'openid'                   => 'baf04e6bbbd06f7b1a197d18ed53b7f1',
    'creid'                    => '110102199701011000',
    'outerid'                  => 'user123',
    'return_appid'             => 'wxcbda96de0b165486',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息

参阅 官方文档

Published on the GitHub by TheNorthMemory