下载对账单
商户可以通过该接口下载历史交易清单。比如掉单、系统错误等导致商户侧和微信侧数据不一致,通过对账单核对后可校正支付状态。
请求参数 | 类型 | 描述 |
---|---|---|
xml | object | 声明请求的XML 数据结构 |
appid | string | 公众账号ID |
mch_id | string | 商户号 |
bill_date | string | 对账单日期 |
bill_type | string | 账单类型 |
tar_type | string | 压缩账单 |
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->v2->pay->downloadbill->postAsync([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
})
->wait();
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance->chain('v2/pay/downloadbill')->postAsync([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
})
->wait();
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$instance['v2/pay/downloadbill']->postAsync([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
])
->then(static function(\Psr\Http\Message\ResponseInterface $response) {
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
})
->wait();
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$response = $instance->v2->pay->downloadbill->post([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
]);
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$response = $instance->chain('v2/pay/downloadbill')->post([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
]);
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$response = $instance['v2/pay/downloadbill']->post([
'sink' => $stream,
'xml' => [
'appid' => 'wx8888888888888888',
'mch_id' => '1900000109',
'bill_date' => '20140603',
'bill_type' => 'ALL',
'tar_type' => 'GZIP',
],
]);
$tmp = $response->getBody();
$tmp->tell() && $tmp->rewind();
$firstFiveBytes = $tmp->read(5);
if ('<xml>' === $firstFiveBytes) {
print_r(\WeChatPay\Transformer::toArray((string) $response->getBody()));
}
异常字典 | 类型 | 描述 |
---|---|---|
return_code | string | 返回状态码 |
return_msg | string | 错误码描述 |
error_code | string | 错误码 |
参阅 官方付款码文档 官方JSAPI文档 官方NATIVE文档 官方APP文档 官方H5文档 官方小程序支付文档 官方人脸支付文档