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));
返回字典类型描述
mchidstring商户号
appidstringAPPID
sp_mchidstring机构商户号
sub_mchidstring子商户号
sp_appidstring机构APPID
sub_appidstring子商户APPID
out_trade_nostring商户订单号
transaction_idstring微信支付订单号
attachstring商户数据
trade_typestring交易类型
AUTH 枚举值
bank_typestring付款银行
success_timestring支付完成时间
trade_statestring交易状态
SUCCESS | REFUND | NOTPAY | CLOSED | PAYERROR | USERPAYING 枚举值之一
trade_state_descstring交易状态描述
payerobject支付者
openidstring用户标识
sp_openidstring机构用户标识
sub_openidstring子商户用户标识
amountobject订单金额
totalinteger订单金额
payer_totalinteger用户支付金额
currencystring订单标价币种
payer_currencystring用户支付币种
exchange_rateobject汇率信息
typestring汇率类型
SETTLEMENT_RATE | USERPAYMENT_RATE 枚举值之一
rateinteger汇率值
promotion_detailobject[]优惠功能
promotion_idstring券ID
namestring优惠名称
scopestring优惠范围
GLOBAL | SINGLE 枚举值之一
typestring优惠类型
COUPON | DISCOUNT 枚举值之一
amountinteger优惠券面额
currencystring优惠币种
activity_idstring活动ID
wxpay_contribute_amountinteger微信出资
merchant_contribute_amountinteger商户出资
other_contribute_amountinteger其他出资
goods_detailobject[]单品列表
goods_idstring商品编码
goods_remarkstring商品备注
discount_amountinteger商品优惠金额
quantityinteger商品数量
priceinteger商品价格

参阅 官方文档

Published on the GitHub by TheNorthMemory