Skip to content

下载发票文件

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

⚠️

本接口依赖前序 获取下载地址 接口返回的 download_url,其中下载地址的域名,路径,参数都可能变化,此文档仅做实现参考。

请求参数类型描述
queryobject声明请求的查询参数
tokenstring前序download_url的查询参数
mchidstring商户号
openidstring通过查询电子发票接口获取的card_openid
invoice_codestring发票代码
invoice_nostring发票号码
fapiao_idstring唯一标识一张发票
php
$downloadUrl = 'https://pay.wechatpay.cn/invoicing/fapiao/fapiao-file?token=xxxxxx';

$client = new \GuzzleHttp\Client();
$client->getAsync($downloadUrl, [
  'sink' => './invoice.pdf',
])
->wait();
php
$downloadUrl = 'https://pay.wechatpay.cn/invoicing/fapiao/fapiao-file?token=xxxxxx';

$client = new \GuzzleHttp\Client();
$client->get($downloadUrl, [
  'sink' => './invoice.pdf',
]);
返回字典类型描述
文件流(保存后按本地PDF文件查看)

参阅

Published on the GitHub by TheNorthMemory