Skip to content

查询订单(商户订单号)

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

请求参数类型描述
base_uristring声明接入点https://apihk.mch.weixin.qq.com/(香港接入)
out_trade_nostring商户订单号
queryobject声明请求的查询参数
mchidstring商户号
sub_mchidstring子商户号
sp_mchidstring机构商户号
php
$instance->v3->global->transactions->outTradeNo->_out_trade_no_->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance->chain('v3/global/transactions/out-trade-no/{out_trade_no}')->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$instance['v3/global/transactions/out-trade-no/{out_trade_no}']->getAsync([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(json_decode((string) $response->getBody(), true));
})
->wait();
php
$response = $instance->v3->global->transactions->outTradeNo->_out_trade_no_->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance->chain('v3/global/transactions/out-trade-no/{out_trade_no}')->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
php
$response = $instance['v3/global/transactions/out-trade-no/{out_trade_no}']->get([
  'base_uri' => 'https://apihk.mch.weixin.qq.com/', // 接入点(香港接入)
  'out_trade_no' => '1217752501201407033233368018',
  'query' => [
    'mchid' => '1900000109',
    'sub_mchid' => '1900000109',
    'sp_mchid' => '1900000100',
  ],
]);
print_r(json_decode((string) $response->getBody(), true));
返回字典类型描述
mchidstring商户号
appidstringAPPID
sp_mchidstring机构商户号
sub_mchidstring子商户号
sp_appidstring机构APPID
sub_appidstring子商户APPID
out_trade_nostring商户订单号
idstring微信支付订单号
attachstring商户数据
trade_typestring交易类型
bank_typestring付款银行
success_timestring支付完成时间
trade_statestring交易状态
trade_state_descstring交易状态描述
payerobject支付者
openidstring用户标识
sp_openidstring机构用户标识
sub_openidstring子商户用户标识
amountobject订单金额
totalinteger订单金额
payer_totalinteger用户支付金额
currencystring订单标价币种
payer_currencystring用户支付币种
exchange_rateobject汇率信息
typestring汇率类型
rateinteger汇率值
promotion_detailobject[]优惠功能
promotion_idstring券ID
namestring优惠名称
scopestring优惠范围
typestring优惠类型
amountinteger优惠券面额
currencystring优惠币种
activity_idstring活动ID
wxpay_contribute_amountinteger微信出资
merchant_contribute_amountinteger商户出资
other_contribute_amountinteger其他出资
goods_detailobject[]单品列表
goods_idstring商品编码
goods_remarkstring商品备注
discount_amountinteger商品优惠金额
quantityinteger商品数量
priceinteger商品价格

参阅 官方文档

Published on the GitHub by TheNorthMemory