Skip to content

查询订单

该接口提供所有微信支付订单的查询,商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。

请求参数类型描述
xmlobject声明请求的XML数据结构
versionstring接口版本号
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
transaction_idstring微信订单号
out_trade_nostring商户订单号
sign_typestring签名类型
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_codestring返回状态码
return_msgstring返回信息
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
err_codestring错误代码
err_code_desstring错误代码描述
device_infostring设备号
openidstring用户标识
is_subscribestring是否关注公众账号
sub_openidstring用户子标识
sub_is_subscribestring是否关注子公众账号
trade_typestring交易类型
trade_statestring交易状态
bank_typestring付款银行
total_feeinteger标价金额
settlement_total_feeinteger应结订单金额
fee_typestring标价币种
cash_feeinteger现金支付金额
cash_fee_typestring现金支付币种
coupon_feeinteger代金券金额
coupon_countinteger代金券使用数量
coupon_type_$nstring代金券类型
coupon_id_$nstring代金券ID
coupon_fee_$ninteger单个代金券支付金额
transaction_idstring微信支付订单号
out_trade_nostring商户订单号
attachstring附加数据
time_endstring支付完成时间
trade_state_descstring交易状态描述
promotion_detailstring营销详情列表,使返回值为Json格式
consume_feeinteger押金消费金额

参阅 官方付款码文档 官方JSAPI文档 官方NATIVE文档 官方APP文档 官方H5文档 官方小程序支付文档

Published on the GitHub by TheNorthMemory