文档

增值税发票识别

更新时间:

本文为您介绍文字识别(ocr)类目下的增值税发票识别RecognizeVATInvoice的语法及示例。

功能描述

增值税发票识别能力可以识别增值税发票(电子发票和纸质发票)关键字段内容,包括:校验码、复核人、开票人、发票代码、收款人等。

说明
  • 增值税发票识别接口仅识别发票中的文本内容,不支持辨别发票真伪。
  • 您可以进入在线咨询获取在线人工帮助。
  • 当前能力可在视觉智能开放平台有完整的免费产品体验,您可以单击立即试用对该能力进行更直观试用以及在线购买。
  • 阿里云视觉智能开放平台视觉AI能力API接入、接口使用或问题咨询等,请通过钉钉群(23109592)加入阿里云视觉智能开放平台咨询群联系我们。

接入指引

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

输入的图像格式参数固定为jpg

返回数据

名称

类型

示例值

描述

RequestId String 56A10D65-ECE0-59DE-9775-F6494D2AF13B

请求ID。

Data Object

返回的结果数据内容。

Box Object

发票关键字位置框,格式为[左上角点X轴坐标,左上角点Y轴坐标,右下角点X轴坐标,右下角点Y轴坐标]。

PayerRegisterNoes Array of Float 358,262,567,290

购买方纳税人识别号位置框信息。

PayeeAddresses Array of Float 355,909,734,939

购买方地址及电话位置框信息。

PayeeBankNames Array of Float 354,947,938,977

购买方开户行及账号位置框信息。

Checkers Array of Float 589,1003,662,1033

复核人位置框信息。

TaxAmounts Array of Float 1606,721,1658,748

合计税额位置框信息。

SumAmounts Array of Float 32,774,629,805

价税合计位置框信息。

Clerks Array of Float 986,1003,1060,1033

开票人位置框信息。

InvoiceNoes Array of Float 1377,78,1478,105

发票号码位置框信息。

InvoiceDates Array of Float 1376,115,1596,145

开票日期位置框信息。

InvoiceCodes Array of Float 1378,41,1520,68

发票代码位置框信息。

InvoiceFakeCodes Array of Float 1376,153,1640,181

校验码位置框信息。

PayerNames Array of Float 354,222,700,255

购买方名称位置框信息。

PayerBankNames Array of Float 0,0,0,0

销售方开户行及账号位置框信息。

Payees Array of Float 189,1003,264,1033

收款人位置框信息。

PayeeNames Array of Float 356,833,633,865

购买方名称位置框信息。

InvoiceAmounts Array of Float 1364, 776,1438,804

价税合计位置框信息。

WithoutTaxAmounts Array of Float 1265,721,1339,749

合计金额位置框信息。

PayerAddresses Array of Float 0,0,0,0

销售方地址及电话位置框信息。

PayeeRegisterNoes Array of Float 356,873,571,902

销售方纳税人识别号位置框信息。

ItemNames Array of Integer 0,0,0,0

货物或应税劳务、服务名称位置框信息。

Content Object

合计金额识别发票各项结果。

PayerAddress String 浙江省杭州市西湖区杭大路9号聚龙大厦西区15-18楼0571-87901580

购买方地址、电话。

PayeeRegisterNo String 91420200000123403

销售方纳税人识别号。

PayeeBankName String 中国银行浙江省分行35845832****

销售方开户行及账号。

InvoiceNo String 03753869

发票号码。

PayerRegisterNo String 91420200000123403

购买方纳税人识别号。

Checker String 张三

复核人。

TaxAmount String 9.52

合计税额。

InvoiceDate String 20190415

开票日期。

WithoutTaxAmount String 190.48

合计金额。

InvoiceAmount String 200.00

价税合计(小写)。

AntiFakeCode String 02702870934284730434

校验码。

PayerName String 三号技术有限责任公司

购买方名称。

Payee String 张三

收款人。

SumAmount String 87

价税合计(大写)。

PayerBankName String 6221************1234

购买方开户行及账号。

Clerk String 张三

开票人。

PayeeName String 上海机场(集团)有限公司

销售方名称。

PayeeAddress String 上海虹桥机场迎宾二路161号22342185

销售方地址、电话。

InvoiceCode String 031001600311

发票代码。

ItemName Array of String 餐饮服务

货物或应税劳务、服务名称。

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)
文档反馈