关闭订单(商户订单号)
以下情况需要调用关单接口:商户订单支付失败需要生成新单号重新发起支付,要对原订单号调用关单,避免重复支付;系统下单后,用户支付超时,系统退出不再受理,避免用户继续,请调用关单接口。
请求参数 | 类型 | 描述 |
---|---|---|
base_uri | string | 声明接入点https://api.mch.weixin.qq.com/hk/ (国内接入) |
out_trade_no | string | 商户订单号 |
json | object | 声明请求的JSON 数据结构 |
mchid | string | 直连商户号 |
sub_mchid | string | 子商户号 |
sp_mchid | string | 机构商户号 |
php
$instance->v3->transactions->outTradeNo->_out_trade_no_->close->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance->chain('v3/transactions/out-trade-no/{out_trade_no}/close')->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$instance['v3/transactions/out-trade-no/{out_trade_no}/close']->postAsync([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r($response->getStatusCode() === 204);
})
->wait();
php
$response = $instance->v3->transactions->outTradeNo->_out_trade_no_->close->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance->chain('v3/transactions/out-trade-no/{out_trade_no}/close')->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
]);
print_r($response->getStatusCode() === 204);
php
$response = $instance['v3/transactions/out-trade-no/{out_trade_no}/close']->post([
'base_uri' => 'https://api.mch.weixin.qq.com/hk/', // 接入点(国内接入)
'out_trade_no' => '1217752501201407033233368018',
'json' => [
'mchid' => '1230000109',
'sub_mchid' => '1230000109',
'sp_mchid' => '1230000109',
],
]);
print_r($response->getStatusCode() === 204);
返回字典 | 类型 | 描述 |
---|---|---|
空字符串(无返回内容) |
参阅 官方文档