Skip to content

撤销

支付交易返回失败或支付系统超时,调用该接口撤销交易。如果此订单用户支付失败,微信支付系统会将此订单关闭;如果用户支付成功,微信支付系统会将此订单资金退还给用户。

请求参数类型描述
out_trade_nostring商户订单号
jsonobject声明请求的JSON数据结构
sp_appidstring合作伙伴应用AppID
sp_mchidstring合作伙伴商户号
sub_appidstring特约商户应用AppID
sub_mchidstring特约商户商户号
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_appidstring合作伙伴应用AppID
sp_mchidstring合作伙伴商户号
sub_appidstring特约商户应用AppID
sub_mchidstring特约商户商户号
out_trade_nostring商户订单号

参阅 官方文档

Published on the GitHub by TheNorthMemory