撤销订单
调用支付接口后请勿立即调用撤销订单API,建议支付后至少15s后再调用撤销订单接口。
请求参数 | 类型 | 描述 |
---|---|---|
xml | object | 声明请求的XML 数据结构 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
transaction_id | string | 微信订单号 |
out_trade_no | string | 商户订单号 |
sign_type | string | 签名类型 |
security | boolean | 声明加载商户API证书 固定值 true |
php
$instance->v2->secapi->pay->reverse->postAsync([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/secapi/pay/reverse')->postAsync([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/secapi/pay/reverse']->postAsync([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->secapi->pay->reverse->post([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/secapi/pay/reverse')->post([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/secapi/pay/reverse']->post([
'xml' => [
'appid' => 'wx8888888888888888',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1217752501201407033233368018',
'out_trade_no' => '1217752501201407033233368018',
'sign_type' => 'HMAC-SHA256',
],
'security' => true,
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码 |
return_msg | string | 返回信息 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
nonce_str | string | 随机字符串 |
sign | string | 签名 |
result_code | string | 业务结果 |
err_code | string | 错误代码 |
err_code_des | string | 错误描述 |
recall | string | 是否重调 |
参阅 官方付款码文档