Skip to content

下载发票文件

调用【获取发票下载信息】接口后,调用该接口下载发票文件。该接口不支持签名和验签。

请求参数类型描述
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./invoice.pdf', 'w+');
$stream  = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$client = new \GuzzleHttp\Client();
$url = 'https://pay.wechatpay.cn/invoicing/fapiao/fapiao-file?token=xxxxxx';

$client->getAsync($url, [
  'sink' => $stream,
])
->wait();
php
$savedTo = \GuzzleHttp\Psr7\Utils::tryFopen('./invoice.pdf', 'w+');
$stream  = \GuzzleHttp\Psr7\Utils::streamFor($savedTo);
$client = new \GuzzleHttp\Client();
$url = 'https://pay.wechatpay.cn/invoicing/fapiao/fapiao-file?token=xxxxxx';

$client->get($url, [
  'sink' => $stream,
]);
返回字典类型描述
文件流(保存后按本地PDF文件查看)

参阅 官方文档 官方文档

Published on the GitHub by TheNorthMemory