申请扣款
委托代扣可应用于定期扣款或需事后扣款以期提高效率的场景。例如高速,停车场等通过用户授权给商户,进行委托扣款的场景。
请求参数 | 类型 | 描述 |
---|---|---|
xml | object | 声明请求的XML 数据结构 |
appid | string | 公众账号id |
mch_id | string | 商户号 |
sign_type | string | 签名类型HMAC-SHA256 枚举值 |
body | string | 商品描述 |
detail | string | 商品详情 |
attach | string | 附加数据 |
out_trade_no | string | 商户订单号 |
total_fee | integer | 总金额 |
fee_type | string | 货币类型 |
spbill_create_ip | string | 终端IP |
goods_tag | string | 商品标记 |
notify_url | string | 回调通知url |
trade_type | string | 交易类型PAP 枚举值 |
version | string | 版本号3.0 枚举值 |
trade_scene | string | 交易场景PARKING | PARKING SPACE | GAS | HIGHWAY | BRIDGE 枚举值之一 |
openid | string | 用户标识 |
profit_sharing | string | 分账标识Y | N 枚举值之一 |
scene_info | string | 场景信息JSON 格式字符串 |
scene_info | object | 场景PARKING 信息 |
start_time | string | 交易时间 |
end_time | string | 结束时间 |
charging_time | string | 计费时长 |
plate_number | string | 车牌号 |
car_type | string | 车辆类型 |
parking_name | string | 停车场名称 |
free_time | string | 免费时长(秒) |
deduct_mode | string | 发起扣费方式PROACTIVE | AUTOPAY 枚举值之一 |
support_deduct_mode | string | 支持的扣费方式DEDUCT_PROACTIVE_ONLY | DEDUCT_AUTOPAY_ONLY | DEDUCT_ALL 枚举值之一 |
scene_info | object | 场景PARKING SPACE 信息 |
start_time | string | 交易时间 |
end_time | string | 结束时间 |
charging_time | string | 计费时长 |
car_type | string | 车辆类型 |
parking_name | string | 停车场名称 |
space_number | string | 车位编号 |
scene_info | object | 场景GAS 信息 |
start_time | string | 交易时间 |
plate_number | string | 车牌号 |
car_type | string | 车辆类型 |
gas_station | string | 加油站名称 |
gas_label_name | string | 油品标号名 |
gas_type | string | 油品类型名称 |
gas_standard | string | 油品标准 |
gas_amount | string | 油量 |
gas_gun_no | string | 油枪号 |
scene_info | object | 场景HIGHWAY 信息 |
start_time | string | 交易时间 |
end_time | string | 结束时间 |
plate_number | string | 车牌号 |
car_type | string | 车辆类型 |
entrance_name | string | 入口站名称 |
exit_name | string | 出口名称 |
carrying_capacity | string | 核载人数 |
carrying_range | string | 核载区间 |
channel_type | string | 通道类型ETC | MTC 枚举值之一 |
scene_info | object | 场景BRIDGE 信息 |
start_time | string | 交易时间 |
plate_number | string | 车牌号 |
car_type | string | 车辆类型 |
exit_name | string | 出口名称 |
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_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
return_msg | string | 返回信息 |
appid | string | 公众账号id |
mch_id | string | 商户号 |
device_info | string | 设备号 |
nonce_str | string | 随机字符串 |
sign | string | 签名 |
result_code | string | 业务结果SUCCESS | FAIL 枚举值之一 |
err_code | string | 错误代码 |
err_code_des | string | 错误代码描述 |
参阅 官方文档