Skip to content

撤销

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

请求参数类型描述
out_trade_nostring商户订单号
jsonobject声明请求的JSON数据结构
appidstring应用AppID
mchidstring直连商户号
php
$instance->v3->pay->transactions->outTradeNo->_out_trade_no_->reverse->postAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/pay/transactions/out-trade-no/{out_trade_no}/reverse')->postAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/pay/transactions/out-trade-no/{out_trade_no}/reverse']->postAsync([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->pay->transactions->outTradeNo->_out_trade_no_->reverse->post([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/pay/transactions/out-trade-no/{out_trade_no}/reverse')->post([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/pay/transactions/out-trade-no/{out_trade_no}/reverse']->post([
  'out_trade_no' => '1217752501201407033233368018',
  'json' => [
    'appid' => 'wxd678efh567hg6787',
    'mchid' => '1230000109',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
appidstring应用AppID
mchidstring直连商户号
out_trade_nostring商户订单号

参阅 官方文档

Published on the GitHub by TheNorthMemory