Skip to content

申请扣款

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

请求参数类型描述
xmlobject声明请求的XML数据结构
appidstring公众账号id
mch_idstring商户号
sign_typestring签名类型
HMAC-SHA256 枚举值
bodystring商品描述
detailstring商品详情
attachstring附加数据
out_trade_nostring商户订单号
total_feeinteger总金额
fee_typestring货币类型
spbill_create_ipstring终端IP
goods_tagstring商品标记
notify_urlstring回调通知url
trade_typestring交易类型
PAP 枚举值
versionstring版本号
3.0 枚举值
trade_scenestring交易场景
PARKING | PARKING SPACE | GAS | HIGHWAY | BRIDGE 枚举值之一
openidstring用户标识
profit_sharingstring分账标识
Y | N 枚举值之一
scene_infostring场景信息JSON格式字符串
scene_infoobject场景PARKING信息
start_timestring交易时间
end_timestring结束时间
charging_timestring计费时长
plate_numberstring车牌号
car_typestring车辆类型
parking_namestring停车场名称
free_timestring免费时长(秒)
deduct_modestring发起扣费方式
PROACTIVE | AUTOPAY 枚举值之一
support_deduct_modestring支持的扣费方式
DEDUCT_PROACTIVE_ONLY | DEDUCT_AUTOPAY_ONLY | DEDUCT_ALL 枚举值之一
scene_infoobject场景PARKING SPACE信息
start_timestring交易时间
end_timestring结束时间
charging_timestring计费时长
car_typestring车辆类型
parking_namestring停车场名称
space_numberstring车位编号
scene_infoobject场景GAS信息
start_timestring交易时间
plate_numberstring车牌号
car_typestring车辆类型
gas_stationstring加油站名称
gas_label_namestring油品标号名
gas_typestring油品类型名称
gas_standardstring油品标准
gas_amountstring油量
gas_gun_nostring油枪号
scene_infoobject场景HIGHWAY信息
start_timestring交易时间
end_timestring结束时间
plate_numberstring车牌号
car_typestring车辆类型
entrance_namestring入口站名称
exit_namestring出口名称
carrying_capacitystring核载人数
carrying_rangestring核载区间
channel_typestring通道类型
ETC | MTC 枚举值之一
scene_infoobject场景BRIDGE信息
start_timestring交易时间
plate_numberstring车牌号
car_typestring车辆类型
exit_namestring出口名称
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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
])
->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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
])
->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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
])
->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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
]);
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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
]);
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'       => \json_encode([
      'scene_info' => [
        'start_time'          => '20170826104339',
        'end_time'            => '20170826114339',
        'charging_time'       => '3600',
        'plate_number'        => '粤B888888',
        'car_type'            => '小型车',
        'parking_name'        => '欢乐海岸停车场',
        'free_time'           => '1200',
        'deduct_mode'         => 'PROACTIVE',
        'support_deduct_mode' => 'DEDUCT_PROACTIVE_ONLY',
      ],
    ]),
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号id
mch_idstring商户号
device_infostring设备号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述

参阅 官方文档

Published on the GitHub by TheNorthMemory