Skip to content

查询红包记录

查询红包记录API只支持查询30天内的红包订单,30天之前的红包订单请登录商户平台查询。如果查询单号对应的数据不存在,那么数据不存在的原因可能是:(1)发放请求还在处理中;(2)红包发放处理失败导致红包订单没有落地。在上述情况下,商户首先需要检查该商户订单号是否确实是自己发起的,如果商户确认是自己发起的,则请商户不要直接当做红包发放失败处理,请商户隔几分钟再尝试查询,或者商户可以通过相同的商户订单号再次发起发放请求。如果商户误把还在发放中的订单直接当发放失败处理,商户应当自行承担因此产生的所有损失和责任。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
mch_billnostring商户订单号
mch_idstring商户号
appidstringAppid
php
$instance->v2->mmpaymkttransfers->queryworkwxredpack->postAsync([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance->chain('v2/mmpaymkttransfers/queryworkwxredpack')->postAsync([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$instance['v2/mmpaymkttransfers/queryworkwxredpack']->postAsync([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
  print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
})
->wait();
php
$response = $instance->v2->mmpaymkttransfers->queryworkwxredpack->post([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance->chain('v2/mmpaymkttransfers/queryworkwxredpack')->post([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
php
$response = $instance['v2/mmpaymkttransfers/queryworkwxredpack']->post([
  'security' => true,
  'xml' => [
    'mch_billno' => '10000098201411111234567890',
    'mch_id'     => '10000098',
    'appid'      => 'wxe062425f740d30d8',
  ],
]);
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
返回字典类型描述
return_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
signstring微信支付签名
result_codestring业务结果
SUCCESS | FAIL 枚举值之一
err_codestring错误代码
err_code_desstring错误代码描述
mch_billnostring商户订单号
mch_idstring商户号
detail_idstring红包单号
statusstring红包状态
SENDING | SENT | FAILED | RECEIVED | RFUND_ING | REFUND 枚举值之一
send_typestring发放类型
API 枚举值
total_amountinteger红包金额
reasonstring失败原因
send_timestring红包发送时间
refund_timestring红包退款时间
refund_amountinteger红包退款金额
wishingstring祝福语
remarkstring活动描述
act_namestring活动名称
openidstring领取红包的Openid
amountinteger金额
rcv_timestring接收时间
sender_namestring发送者名称
sender_header_media_idstring发送者头像

参阅 官方文档

Published on the GitHub by TheNorthMemory