查询订单
该接口提供所有微信支付订单的查询,商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。
请求参数 | 类型 | 描述 |
---|---|---|
xml | object | 声明请求的XML 数据结构 |
version | string | 接口版本号1.0 枚举值 |
appid | string | 公众账号ID |
sub_appid | string | 子商户公众账号ID |
mch_id | string | 商户号 |
sub_mch_id | string | 子商户号 |
transaction_id | string | 微信订单号 |
out_trade_no | string | 商户订单号 |
sign_type | string | 签名类型MD5 | HMAC-SHA256 枚举值之一 |
php
$instance->v2->pay->orderquery->postAsync([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/pay/orderquery')->postAsync([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/pay/orderquery']->postAsync([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->pay->orderquery->post([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/pay/orderquery')->post([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/pay/orderquery']->post([
'xml' => [
'version' => '1.0',
'appid' => 'wxd678efh567hg6787',
'sub_appid' => 'wx8888888888888888',
'mch_id' => '1230000109',
'sub_mch_id' => '1900000100',
'transaction_id' => '1009660380201506130728806387',
'out_trade_no' => '20150806125346',
'sign_type' => 'HMAC-SHA256',
],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码SUCCESS | FAIL 枚举值之一 |
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 | 业务结果SUCCESS | FAIL 枚举值之一 |
err_code | string | 错误代码 |
err_code_des | string | 错误代码描述 |
device_info | string | 设备号 |
openid | string | 用户标识 |
is_subscribe | string | 是否关注公众账号Y | N 枚举值之一 |
sub_openid | string | 用户子标识 |
sub_is_subscribe | string | 是否关注子公众账号Y | N 枚举值之一 |
trade_type | string | 交易类型 |
trade_state | string | 交易状态SUCCESS | REFUND | NOTPAY | CLOSED | REVOKED | USERPAYING | PAYERROR | ACCEPT 枚举值之一 |
bank_type | string | 付款银行 |
total_fee | integer | 标价金额 |
settlement_total_fee | integer | 应结订单金额 |
fee_type | string | 标价币种 |
cash_fee | integer | 现金支付金额 |
cash_fee_type | string | 现金支付币种 |
coupon_fee | integer | 代金券金额 |
coupon_count | integer | 代金券使用数量 |
coupon_type_$n | string | 代金券类型 |
coupon_id_$n | string | 代金券ID |
coupon_fee_$n | integer | 单个代金券支付金额 |
transaction_id | string | 微信支付订单号 |
out_trade_no | string | 商户订单号 |
attach | string | 附加数据 |
time_end | string | 支付完成时间 |
trade_state_desc | string | 交易状态描述 |
promotion_detail | string | 营销详情JSON 格式字符串 |
promotion_id | string | 券ID |
name | string | 优惠名称 |
scope | string | 优惠范围GLOBAL | SINGLE 枚举值之一 |
type | string | 优惠类型COUPON | DISCOUNT 枚举值之一 |
amount | string | 优惠券面额 |
activity_id | string | 活动ID |
wxpay_contribute | string | 微信出资 |
merchant_contribute | string | 商户出资 |
other_contribute | string | 其他出资 |
goods_detail | object[] | 单品列表 |
goods_id | string | 商品编码 |
wxpay_goods_id | string | 微信支付商品编码 |
goods_name | string | 商品名称 |
quantity | number | 商品数量 |
price | number | 商品单价 |
consume_fee | integer | 押金消费金额 |