Skip to content

下载资金账单

商户可以通过该接口下载自2017年6月1日起 的历史资金流水账单。

请求参数类型描述
securitytrue声明加载商户API证书
xmlobject声明请求的XML数据结构
appidstring公众账号ID
mch_idstring商户号
sign_typestring签名类型
固定枚举值HMAC-SHA256
bill_datestring资金账单日期
account_typestring资金账户类型
Basic | Operation | Fees 枚举值之一
tar_typestring压缩账单
GZIP 枚举值
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./somehowfile.csv.gz', 'w+');
$stream  = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);

$instance->v2->pay->downloadfundflow->postAsync([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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/downloadfundflow')->postAsync([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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/downloadfundflow']->postAsync([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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->downloadfundflow->post([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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/downloadfundflow')->post([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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/downloadfundflow']->post([
  'sink' => $stream,
  'security' => true,
  'xml' => [
    'appid'        => 'wx8888888888888888',
    'mch_id'       => '1900000109',
    'sign_type'    => 'HMAC-SHA256',
    'bill_date'    => '20140603',
    'account_type' => 'Basic',
    '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_codestring返回状态码
SUCCESS | FAIL 枚举值之一
return_msgstring返回信息
result_codestring业务结果
FAIL 枚举值
err_codestring错误代码
err_code_desstring错误代码描述

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

Published on the GitHub by TheNorthMemory