Skip to content

申请扣款

委托代扣可应用于定期扣款或需事后扣款以期提高效率的场景。例如高速,停车场等通过用户授权给商户,进行委托扣款的场景。

请求参数类型描述
xmlobject声明请求的XML数据结构
appidstring公众账号id
mch_idstring商户号
sign_typestring签名类型
bodystring商品描述
detailstring商品详情
attachstring附加数据
out_trade_nostring商户订单号
total_feeinteger总金额
fee_typestring货币类型
spbill_create_ipstring终端IP
goods_tagstring商品标记
notify_urlstring回调通知url
trade_typestring交易类型
versionstring版本号
trade_scenestring交易场景
openidstring用户标识
profit_sharingstring分账标识
scene_infostring场景信息
start_timestring交易时间
end_timestring结束时间
charging_timestring计费时长
plate_numberstring车牌号
car_typestring车辆类型
parking_namestring停车场名称
deduct_modestring发起扣费方式
support_deduct_modestring支持的扣费方式
space_numberstring车位编号
gas_stationstring加油站名称
gas_label_namestring油品标号名
gas_typestring油品类型名称
gas_standardstring油品标准
gas_amountstring油量
gas_gun_nostring油枪号
entrance_namestring入口站名称
exit_namestring出口名称
carrying_capacitystring核载人数
carrying_rangestring核载区间
channel_typestring通道类型
php
$instance->v2->vehicle->pay->payapply->postAsync([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/vehicle/pay/payapply')->postAsync([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/vehicle/pay/payapply']->postAsync([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->vehicle->pay->payapply->post([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/vehicle/pay/payapply')->post([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/vehicle/pay/payapply']->post([
  'xml' => [
    'appid' => 'wxcbda96de0b165486',
    'mch_id' => '10000098',
    'sign_type' => 'HMAC-SHA256',
    'body' => '公交代扣',
    'detail' => '公交代扣:A公交代扣:B公交代扣:C',
    'attach' => '自定义参数',
    'out_trade_no' => '1217752501201407033233368018',
    'total_fee' => '888',
    'fee_type' => 'CNY',
    'spbill_create_ip' => '8.8.8.8',
    'goods_tag' => 'WXG',
    'notify_url' => 'http://yoursite.com/wxpay.html',
    'trade_type' => 'PAP',
    'version' => '3.0',
    'trade_scene' => 'PARKING',
    'openid' => 'oUpF8uMuAJO_M2pxb1Q9zNjWeS6o',
    'profit_sharing' => 'Y',
    'scene_info' => '{"scene_info":{"start_time":"20170926114339","end_time":"20170826114339","charging_time":"12312312312","plate_number":"CB1000sdfasd","free_time":"1200","car_type":"大型车","parking_name":"欢乐海岸停车场"}}',
    'start_time' => '20170826104339',
    'end_time' => '20170826114339',
    'charging_time' => '3600',
    'plate_number' => '粤B888888',
    'car_type' => '小型车',
    'parking_name' => '欢乐海岸停车场',
    'deduct_mode' => 'PROACTIVE',
    'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
    'space_number' => 'D6666',
    'gas_station' => '中国石油加油站',
    'gas_label_name' => '98',
    'gas_type' => '汽油',
    'gas_standard' => '国V',
    'gas_amount' => '50120',
    'gas_gun_no' => '10',
    'entrance_name' => '沿江深圳-大铲湾',
    'exit_name' => '虎门大桥',
    'carrying_capacity' => '10',
    'carrying_range' => '6-12',
    'channel_type' => 'ETC',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
return_msgstring返回信息
appidstring公众账号id
mch_idstring商户号
device_infostring设备号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
err_codestring错误代码
err_code_desstring错误代码描述

参阅 官方文档

Published on the GitHub by TheNorthMemory