Skip to content

扣费受理

请求参数类型描述
jsonobject声明请求的JSON数据结构
appidstring商户在微信申请公众号或移动应用成功后分配的账号ID
sub_appidstring子公众账号ID,服务商模式下选传,用于扣费信息的商户信息展示。
sub_mchidstring微信支付分配的子商户号
descriptionstring商户自定义字段,用于交易账单中对扣费服务的描述。
attachstring附加数据,在查询API和支付通知中原样返回
out_trade_nostring商户系统内部订单号
trade_scenestring交易场景值,现在支持公交和地铁的场景值
BUS | METRO 枚举值之一
goods_tagstring代金券或立减优惠功能的参数
contract_idstring签约成功后,微信返回代扣签约ID
notify_urlstring接受扣款结果异步回调通知的URL
amountobject
totalinteger订单总金额,单位为分
currencystring符合ISO 4217标准的三位字母代码,目前只支持人民币:CNY
bus_infoobject
start_timestring用户乘车时间(上车)
line_namestring乘车路线
plate_numberstring车牌号。
metro_infoobject
start_timestring用户乘车时间(上车)
end_timestring用户下车时间
start_stationstring乘车起始站
end_stationstring乘车终点站
php
$instance->v3->qrcode->transactions->postAsync([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/qrcode/transactions')->postAsync([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/qrcode/transactions']->postAsync([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->qrcode->transactions->post([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/qrcode/transactions')->post([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/qrcode/transactions']->post([
  'json' => [
    'appid' => 'wxcbda96de0b165486',
    'sub_appid' => 'wxcbda96de0b165486',
    'sub_mchid' => '1900000109',
    'description' => '地铁扣费',
    'attach' => '深圳分店',
    'out_trade_no' => '20150806125346',
    'trade_scene' => 'BUS',
    'goods_tag' => 'WXG',
    'contract_id' => 'Wx15463511252015071056489715',
    'notify_url' => 'https://pay.weixin.qq.com/wxpay.html',
    'amount' => [
      'total' => 600,
      'currency' => 'CNY',
    ],
    'bus_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'line_name' => '1路公车',
      'plate_number' => '粤B888888',
    ],
    'metro_info' => [
      'start_time' => '2017-08-26T10:43:39+08:00',
      'end_time' => '2017-08-26T10:43:39+08:00',
      'start_station' => '西单',
      'end_station' => '天安门西',
    ],
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring
sub_appidstring
sp_mchidstring
sub_mchidstring
descriptionstring
create_timestring
out_trade_nostring
transaction_idstring
trade_statestringSUCCESS | ACCEPTED | PAY_FAIL | REFUND 枚举值之一
trade_state_descriptionstring
success_timestring
bank_typestring
user_repay_statestringNOT_REPAY | REPAID | ALL_REFUND 枚举值之一
repay_transaction_idstring
repay_timestring
attachstring
contract_idstring
trade_scenestring
bus_infoobject
start_timestring用户乘车时间(上车)
line_namestring乘车路线
plate_numberstring车牌号。
metro_infoobject
start_timestring用户乘车时间(上车)
end_timestring用户下车时间
start_stationstring乘车起始站
end_stationstring乘车终点站
amountobject
promotion_detailobject[]
coupon_idstring
namestring
scopestringGLOBAL | SINGLE 枚举值之一
typestringCASH | NOCASH 枚举值之一
stock_idstring
amountinteger
wechatpay_contributeinteger
merchant_contributeinteger
other_contributeinteger
currencystring

参阅 。

Published on the GitHub by TheNorthMemory