撤销
支付交易返回失败或支付系统超时,调用该接口撤销交易。如果此订单用户支付失败,微信支付系统会将此订单关闭;如果用户支付成功,微信支付系统会将此订单资金退还给用户。
请求参数 | 类型 | 描述 |
---|---|---|
out_trade_no | string | 商户订单号 |
json | object | 声明请求的JSON 数据结构 |
sp_appid | string | 合作伙伴应用AppID |
sp_mchid | string | 合作伙伴商户号 |
sub_appid | string | 特约商户应用AppID |
sub_mchid | string | 特约商户商户号 |
php
$instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->reverse->postAsync([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}/reverse')->postAsync([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}/reverse']->postAsync([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->pay->partner->transactions->outTradeNo->_out_trade_no_->reverse->post([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/pay/partner/transactions/out-trade-no/{out_trade_no}/reverse')->post([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/pay/partner/transactions/out-trade-no/{out_trade_no}/reverse']->post([
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'sp_appid' => 'wxd678efh567hg6787',
'sp_mchid' => '1230000109',
'sub_appid' => 'wxd678efh567hg6787',
'sub_mchid' => '1230000109',
],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典 | 类型 | 描述 |
---|---|---|
sp_appid | string | 合作伙伴应用AppID |
sp_mchid | string | 合作伙伴商户号 |
sub_appid | string | 特约商户应用AppID |
sub_mchid | string | 特约商户商户号 |
out_trade_no | string | 商户订单号 |
参阅 官方文档