Skip to content

支付扣款

可应用于定期扣款或需事后扣款以期提高效率的场景。例如:水电煤缴费、话费、充电宝租借等场景。

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/(香港接入)
jsonobject声明请求的JSON数据结构
appidstring机构APPID
sp_appidstring机构appid
sub_mchidstring子商户号
sub_appidstring子商户应用ID
descriptionstring商品描述
attachstring商户数据
notify_urlstring通知地址
out_trade_nostring商户订单号
goods_tagstring商品标记
merchant_category_codestringMCC码
contract_idstring委托代扣协议ID
amountobject订单金额
totalinteger总金额
currencystring货币类型
scene_infoobject场景信息
device_idstring商户端设备号
device_ipstring商户端设备IP
php
$instance->v3->global->papay->transactions->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/global/papay/transactions')->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/global/papay/transactions']->postAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->global->papay->transactions->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/global/papay/transactions')->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/global/papay/transactions']->post([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'json' => [
    'appid'                  => 'wxd678efh567hg6787',
    'sp_appid'               => 'wx8888888888888888',
    'sub_mchid'              => '1230000109',
    'sub_appid'              => 'wxcbda96de0b165484',
    'description'            => 'image形象店-深圳腾大- QQ公仔',
    'attach'                 => '自定义数据',
    'notify_url'             => 'https://www.weixin.qq.com/wxpay/pay.php',
    'out_trade_no'           => '1217752501201407033233368018',
    'goods_tag'              => 'WXG',
    'merchant_category_code' => '1011',
    'contract_id'            => '100005698',
    'amount'                 => [
      'total'    => 888,
      'currency' => 'HKD',
    ],
    'scene_info'             => [
      'device_id' => '013467007045764',
      'device_ip' => '128.0.0.1',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述

参阅 官方文档

Published on the GitHub by TheNorthMemory