上传出租车电子发票文件
服务商调用插卡接口前,需调用本接口上传出租车电子发票文件来获取文件ID。文件ID有效期为3天,有效期内未成功调用插卡接口需重新调用本接口上传发票文件。 官方文档
js
const { Multipart } = require('wechatpay-axios-plugin')
const { createReadStream } = require('fs')
const { basename } = require('path')
const localFilePath = '/path/to/merchant-invoice-file.pdf'
const stream = createReadStream(localFilePath)
const media = new Multipart()
.append('meta', JSON.stringify({
company_mchid,
region_id,
digest_algorithm: 'DIGEST_ALGORITHM_SM3',
digest: 'from upstream or local calculated',
}))
.append('file', stream, basename(localFilePath))
wxpay.v3.taxiInvoice.cards.uploadFile.post(media)
.then(
({
data: {
fapiao_media_id,
},
}) => ({
fapiao_media_id,
})
)