消费押金
微信支付根据商户指令,将用户消费金额扣除手续费后结算给指定商户,剩余金额原路退还给用户,并生成押金退款交易记录,给用户下发押金退还发起通知,并更改押金支付的交易记录。用户押金退还到账后,下发押金退还到账通知。若全部消费,则下发押金全部消费通知;
请求参数 | 类型 | 描述 |
---|---|---|
security | true | 声明加载商户API证书 |
xml | object | 声明请求的XML 数据结构 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
transaction_id | string | 微信订单号 |
out_trade_no | string | 商户订单号 |
total_fee | integer | 押金总金额 |
consume_fee | integer | 消费金额 |
fee_type | string | 货币类型 |
sign_type | string | 签名类型HMAC-SHA256 枚举值 |
php
$instance->v2->deposit->consume->postAsync([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/deposit/consume')->postAsync([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/deposit/consume']->postAsync([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->deposit->consume->post([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/deposit/consume')->post([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/deposit/consume']->post([
'security' => true,
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000100',
'sub_mch_id' => '1900000100',
'transaction_id' => '013467007045764',
'out_trade_no' => '1217752501201407033233368018',
'total_fee' => '888',
'consume_fee' => '888',
'fee_type' => 'CNY',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
return_msg | string | 返回信息 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
nonce_str | string | 随机字符串 |
sign | string | 签名 |
result_code | string | 业务结果SUCCESS | FAIL 枚举值之一 |
err_code | string | 错误代码 |
err_code_des | string | 错误代码描述 |
transaction_id | string | 微信订单号 |
out_trade_no | string | 商户订单号 |
total_fee | integer | 押金总金额 |
consume_fee | integer | 消费金额 |
fee_type | string | 货币类型 |
参阅 官方文档