撤销订单(微信支付订单号)
支付交易返回失败或支付系统超时,调用该接口撤销交易。如果此订单用户支付失败,微信支付系统会将此订单关闭;如果用户支付成功,微信支付系统会将此订单资金退还给用户。
请求参数 | 类型 | 描述 |
---|---|---|
base_uri | string | 声明接入点https://api.mch.weixin.qq.com/hk/ (国内接入) |
json | object | 声明请求的JSON 数据结构 |
mchid | string | 商户号 |
sp_mchid | string | 机构商户号 |
sub_mchid | string | 子商户号 |
transaction_id | string | 微信订单号 |
php
$instance->v3->transactions->id->_transaction_id_->reverse->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance->chain('v3/transactions/id/{transaction_id}/reverse')->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance['v3/transactions/id/{transaction_id}/reverse']->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$response = $instance->v3->transactions->id->_transaction_id_->reverse->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance->chain('v3/transactions/id/{transaction_id}/reverse')->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance['v3/transactions/id/{transaction_id}/reverse']->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'json' => [
'mchid' => '1900000109',
'sp_mchid' => '1900000100',
'sub_mchid' => '1900000109',
],
'transaction_id' => '1217752501201407033233368018',
]);
print_r($response->getStatusCode() === 204);
返回字典 | 类型 | 描述 |
---|---|---|
空字符串(无返回内容) |
参阅 官方文档