Skip to content

查询订单

该接口提供所有微信支付订单的查询,商户可以通过查询订单接口主动查询订单状态,完成下一步的业务逻辑。需要调用查询接口的情况:◆ 当商户后台、网络、服务器等出现异常,商户系统最终未接收到支付通知;◆ 调用支付接口后,返回系统错误或未知交易状态情况;◆ 调用关单或撤销接口API之前,需确认支付状态;

请求参数类型描述
xmlobject声明请求的XML数据结构
versionstring接口版本号
1.0 枚举值
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
transaction_idstring微信订单号
out_trade_nostring商户订单号
sign_typestring签名类型
MD5 | HMAC-SHA256 枚举值之一
php
$instance->v2->pay->facepayquery->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/facepayquery')->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/facepayquery']->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->facepayquery->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/facepayquery')->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/facepayquery']->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返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
appidstring公众账号ID
sub_appidstring子商户公众账号ID
mch_idstring商户号
sub_mch_idstring子商户号
nonce_strstring随机字符串
signstring签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
device_infostring设备号
openidstring用户标识
is_subscribestring是否关注公众账号
Y | N 枚举值之一
sub_openidstring用户子标识
sub_is_subscribestring是否关注子公众账号
Y | N 枚举值之一
trade_typestring交易类型
trade_statestring交易状态
SUCCESS | REFUND | NOTPAY | CLOSED | REVOKED | USERPAYING | PAYERROR | ACCEPT 枚举值之一
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格式字符串
promotion_idstring券ID
namestring优惠名称
scopestring优惠范围
GLOBAL | SINGLE 枚举值之一
typestring优惠类型
COUPON | DISCOUNT 枚举值之一
amountstring优惠券面额
activity_idstring活动ID
wxpay_contributestring微信出资
merchant_contributestring商户出资
other_contributestring其他出资
goods_detailobject[]单品列表
goods_idstring商品编码
wxpay_goods_idstring微信支付商品编码
goods_namestring商品名称
quantitynumber商品数量
pricenumber商品单价
consume_feeinteger押金消费金额

参阅 官方人脸支付文档

Published on the GitHub by TheNorthMemory