本文为您介绍文字识别(ocr)类目下的增值税发票识别RecognizeVATInvoice的语法及示例。
功能描述
增值税发票识别能力可以识别增值税发票(电子发票和纸质发票)关键字段内容,包括:校验码、复核人、开票人、发票代码、收款人等。
接入指引
1. 注册阿里云账号:打开阿里云官网,在阿里云官网右上角,单击立即注册,按照操作提示完成账号注册。
2. 开通能力:请确保您已开通文字识别服务,若未开通服务请立即开通。
3. 创建AccessKey:请确保您已创建AccessKey,如果您使用的是子账号AccessKey,您需要给子账号赋予AliyunVIAPIFullAccess权限,具体操作,请参见RAM授权。
4. 在线调试(可选):您可以通过OpenAPI Explorer在线调试能力,查看完整的调用示例代码及SDK依赖信息,也可以下载完整的工程。
5. 开发接入步骤:
- 在SDK总览中选择您要接入使用的SDK语言。
- 在对应语言的SDK文档中找到AI类目为文字识别(ocr)的SDK包进行安装。
- 参考文档中提供的示例代码进行适当修改后调用。
6. 示例代码:该能力常用语言的示例代码,请参见增值税发票识别示例代码。
7. 客户端直接调用:该能力常用的客户端调用方式包括以下几种。
输入限制
- 图像格式:PNG、JPG、JPEG、BMP、WebP、PDF。
- 图像大小:不超过3 MB。
- 图像分辨率:大于15×15像素,小于4096×4096像素。
- URL地址中不能包含中文字符。
计费说明
关于增值税发票识别的计费方式及报价,请参见计费介绍。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
名称 |
类型 |
是否必选 |
示例值 |
描述 |
Action | String | 是 | RecognizeVATInvoice | 系统规定参数。取值:RecognizeVATInvoice。 |
FileURL | String | 是 | http://viapi-test.oss-cn-shanghai.aliyuncs.com/viapi-3.0domepic/ocr/RecognizeVATInvoice/RecognizeVATInvoice3.jpg | 图像URL地址。推荐使用上海地域的OSS链接,对于文件在本地或者非上海地域OSS链接的情况,请参见文件URL处理。 |
FileType | String | 是 | jpg | 输入的图像格式参数固定为 |
返回数据
SDK参考
阿里云视觉AI文字识别类目下的增值税发票识别能力推荐使用SDK调用,支持多种编程语言,调用时请选择AI类目为文字识别(ocr)的SDK包,文件参数通过SDK调用可支持本地文件及任意URL,具体可参见SDK总览。
示例代码
该能力常用语言的示例代码,请参见增值税发票识别示例代码。
示例
请求示例
http(s)://ocr.cn-shanghai.aliyuncs.com/?Action=RecognizeVATInvoice //更多关于访问域名(Endpoint)信息,请参见:https://help.aliyun.com/document_detail/143103.html
&FileType=jpg
&FileURL=https://vision.aliyun.com/experience/detail?&tagName=ocr&children=RecognizeVATInvoice
&<公共请求参数>
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<RecognizeVATInvoiceResponse>
<RequestId>56A10D65-ECE0-59DE-9775-F6494D2AF13B</RequestId>
<Data>
<Content>
<Checker/>
<PayeeAddress>浙江省杭州市西湖区杭大路9号聚龙大厦西区15-18楼0571-87901580</PayeeAddress>
<PayeeName>三号技术有限责任公司</PayeeName>
<PayerAddress/>
<AntiFakeCode>60966753003521159330</AntiFakeCode>
<PayerBankName/>
<InvoiceNo>3753869</InvoiceNo>
<PayerRegisterNo>91420200000123403</PayerRegisterNo>
<WithoutTaxAmount>82.08</WithoutTaxAmount>
<InvoiceAmount>87</InvoiceAmount>
<PayerName>三号技术有限责任公司</PayerName>
<TaxAmount>4.92</TaxAmount>
<PayeeBankName>中国银行浙江省分行35845832****</PayeeBankName>
<Clerk/>
<ItemName>餐饮服务</ItemName>
<PayeeRegisterNo>91420200000123403</PayeeRegisterNo>
<InvoiceCode>33002000411</InvoiceCode>
<InvoiceDate>2020年12月15日</InvoiceDate>
<SumAmount>87</SumAmount>
<Payee/>
</Content>
<Box>
<PayerRegisterNoes>118</PayerRegisterNoes>
<PayerRegisterNoes>128</PayerRegisterNoes>
<PayerRegisterNoes>278</PayerRegisterNoes>
<PayerRegisterNoes>138</PayerRegisterNoes>
<PayerAddresses>0</PayerAddresses>
<PayerAddresses>0</PayerAddresses>
<PayerAddresses>0</PayerAddresses>
<PayerAddresses>0</PayerAddresses>
<InvoiceAmounts>207</InvoiceAmounts>
<InvoiceAmounts>347</InvoiceAmounts>
<InvoiceAmounts>278</InvoiceAmounts>
<InvoiceAmounts>355</InvoiceAmounts>
<InvoiceDates>585</InvoiceDates>
<InvoiceDates>60</InvoiceDates>
<InvoiceDates>675</InvoiceDates>
<InvoiceDates>69</InvoiceDates>
<PayeeAddresses>118</PayeeAddresses>
<PayeeAddresses>407</PayeeAddresses>
<PayeeAddresses>407</PayeeAddresses>
<PayeeAddresses>415</PayeeAddresses>
<Clerks>0</Clerks>
<Clerks>0</Clerks>
<Clerks>0</Clerks>
<Clerks>0</Clerks>
<WithoutTaxAmounts>546</WithoutTaxAmounts>
<WithoutTaxAmounts>327</WithoutTaxAmounts>
<WithoutTaxAmounts>584</WithoutTaxAmounts>
<WithoutTaxAmounts>337</WithoutTaxAmounts>
<Checkers>0</Checkers>
<Checkers>0</Checkers>
<Checkers>0</Checkers>
<Checkers>0</Checkers>
<TaxAmounts>696</TaxAmounts>
<TaxAmounts>328</TaxAmounts>
<TaxAmounts>724</TaxAmounts>
<TaxAmounts>335</TaxAmounts>
<InvoiceCodes>583</InvoiceCodes>
<InvoiceCodes>16</InvoiceCodes>
<InvoiceCodes>643</InvoiceCodes>
<InvoiceCodes>25</InvoiceCodes>
<SumAmounts>207</SumAmounts>
<SumAmounts>347</SumAmounts>
<SumAmounts>278</SumAmounts>
<SumAmounts>355</SumAmounts>
<ItemNames>0</ItemNames>
<ItemNames>0</ItemNames>
<ItemNames>0</ItemNames>
<ItemNames>0</ItemNames>
<PayerNames>119</PayerNames>
<PayerNames>109</PayerNames>
<PayerNames>237</PayerNames>
<PayerNames>118</PayerNames>
<InvoiceFakeCodes>583</InvoiceFakeCodes>
<InvoiceFakeCodes>82</InvoiceFakeCodes>
<InvoiceFakeCodes>700</InvoiceFakeCodes>
<InvoiceFakeCodes>90</InvoiceFakeCodes>
<PayeeBankNames>119</PayeeBankNames>
<PayeeBankNames>423</PayeeBankNames>
<PayeeBankNames>282</PayeeBankNames>
<PayeeBankNames>431</PayeeBankNames>
<PayeeNames>117</PayeeNames>
<PayeeNames>371</PayeeNames>
<PayeeNames>226</PayeeNames>
<PayeeNames>381</PayeeNames>
<Payees>0</Payees>
<Payees>0</Payees>
<Payees>0</Payees>
<Payees>0</Payees>
<InvoiceNoes>582</InvoiceNoes>
<InvoiceNoes>38</InvoiceNoes>
<InvoiceNoes>623</InvoiceNoes>
<InvoiceNoes>46</InvoiceNoes>
<PayerBankNames>0</PayerBankNames>
<PayerBankNames>0</PayerBankNames>
<PayerBankNames>0</PayerBankNames>
<PayerBankNames>0</PayerBankNames>
<PayeeRegisterNoes>119</PayeeRegisterNoes>
<PayeeRegisterNoes>389</PayeeRegisterNoes>
<PayeeRegisterNoes>247</PayeeRegisterNoes>
<PayeeRegisterNoes>400</PayeeRegisterNoes>
</Box>
</Data>
</RecognizeVATInvoiceResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "56A10D65-ECE0-59DE-9775-F6494D2AF13B",
"Data" : {
"Content" : {
"Checker" : "",
"PayeeAddress" : "浙江省杭州市西湖区杭大路9号聚龙大厦西区15-18楼0571-87901580",
"PayeeName" : "三号技术有限责任公司",
"PayerAddress" : "",
"AntiFakeCode" : "60966753003521159330",
"PayerBankName" : "",
"InvoiceNo" : 3753869,
"PayerRegisterNo" : "91420200000123403",
"WithoutTaxAmount" : 82.08,
"InvoiceAmount" : 87,
"PayerName" : "三号技术有限责任公司",
"TaxAmount" : 4.92,
"PayeeBankName" : "中国银行浙江省分行35845832****",
"Clerk" : "",
"ItemName" : "餐饮服务",
"PayeeRegisterNo" : "91420200000123403",
"InvoiceCode" : 33002000411,
"InvoiceDate" : "2020年12月15日",
"SumAmount" : 87,
"Payee" : ""
},
"Box" : {
"PayerRegisterNoes" : [ 118, 128, 278, 138 ],
"PayerAddresses" : [ 0, 0, 0, 0 ],
"InvoiceAmounts" : [ 207, 347, 278, 355 ],
"InvoiceDates" : [ 585, 60, 675, 69 ],
"PayeeAddresses" : [ 118, 407, 407, 415 ],
"Clerks" : [ 0, 0, 0, 0 ],
"WithoutTaxAmounts" : [ 546, 327, 584, 337 ],
"Checkers" : [ 0, 0, 0, 0 ],
"TaxAmounts" : [ 696, 328, 724, 335 ],
"InvoiceCodes" : [ 583, 16, 643, 25 ],
"SumAmounts" : [ 207, 347, 278, 355 ],
"ItemNames" : [ 0, 0, 0, 0 ],
"PayerNames" : [ 119, 109, 237, 118 ],
"InvoiceFakeCodes" : [ 583, 82, 700, 90 ],
"PayeeBankNames" : [ 119, 423, 282, 431 ],
"PayeeNames" : [ 117, 371, 226, 381 ],
"Payees" : [ 0, 0, 0, 0 ],
"InvoiceNoes" : [ 582, 38, 623, 46 ],
"PayerBankNames" : [ 0, 0, 0, 0 ],
"PayeeRegisterNoes" : [ 119, 389, 247, 400 ]
}
}
}
错误码
关于增值税发票识别的错误码,详情请参见常见错误码。
安全声明
- 请确保上传的图片或文件来源符合相应的法律法规。
- 通过体验调试上传的临时文件有效期为1小时,在24小时后会被系统自动清理删除。
- 本页导读 (1)
- 功能描述
- 接入指引
- 输入限制
- 计费说明
- 调试
- 请求参数
- 返回数据
- SDK参考
- 示例代码
- 示例
- 错误码
- 安全声明