2、调用客户端运行环境
当客户端使用的编程语言为Java时,请使用1.5及以上版本JRE。
3、服务主要功能描述
发票识别服务,支持增值税发票识别、火车票识别、机动车销售统一发票识别、PDF电子发票识别(仅支持PDF格式识别)、定额发票识别、出租车发票识别、航空运输电子客票行程单识别,并支持自动分类。识别速度快,支持扫描件识别和拍照识别。
1) 通过https协议post方法上传各种发票图像文件,通过https接口进行识别;
2) 将识别结果以XML或json格式返回给用户;
4、服务调用约束
在调用发票识别接口前,请您确保客户端程序或设备网络连接通畅,要求图像文件大小在200KB左右,扫描图像建议分辨率为300DPI,图像小于3M。
二、前提准备
1、用户登录 注册账号
- 输入注册信息,确认无误后点击同意条款并注册
3、注册成功后点击右上角的账号名称-个人中心,进入管理页面
(注:调用图片为base64流接口时传参数img,调用图片为file格式接口传参数file)
接口调用方法:post
3、请求参数
名称 | 类型 | 必填 | 说明 |
img | String | 是 | 上传的文件(图片的base64流) |
key | String | 是 | 用户ocrKey |
file | MultipartFile | 是 | 上传的文件(上传文件的字段名必须是“file”) |
secret | String | 是 | 用户ocrSecrert |
typeId | Integer | 是 | 识别类型(增值税发票2009;机动车发票20094;火车票20092; |
outvalue | String | 是 | 输出选项(0为全部返回) |
format | String | 是 | 返回格式(xml或者json),如果format为空,则默认返回xml |
识别结果字符串
<status/>标签显示了识别状态,大于等于“0”代表识别成功【“0”代表查询成功,“1”代表未查到数据,“2”代表查询失败】,小于“0”代表识别失败,失败的原因在<value/>中描述。
调用错误码
status值 | 描述 |
-1 | 用户已屏蔽 |
-2 | 用户key或secret验证错误 |
-3 | 服务次数不足 |
-4 | 用户未找到 |
-6 | 系统异常 |
-7 | 图片不可为空,参数不可为空 |
-8 | 类型错误 |
识别错误码1
status值 | 描述 |
-1 | 识别失败 |
识别错误码2
value值 | 描述 |
InvoiceRecognizeImage4 | 裁切图像失败 |
InvoiceRecognizeImage5 | 加载图像失败 |
InvoiceRecognizeImage6 | 识别失败 |
Interface call error | 接口调用错误 |
调用方式(java客户端基于httpclient4.3)
1.依赖库: \java客户端\httpClient4.3库\
2.示例程序代码详见: \java客户端\httpClientDemo\中的Client类
在main方法定义参数,并传入 doPost(url, file, key, secret, typeId,outvalue, format)方法中。
执行main方法返回识别结果如下:
{
"message":{
"status":0,
"value":"识别完成"
},
"cardsinfo":[
{
"type":"2009",
"items":[
{
"nID":null,
"index":null,
"desc":"发票代码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"发票号码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"开票日期",
"content":""
},
{
"nID":null,
"index":null,
"desc":"机器编号",
"content":""
},
{
"nID":null,
"index":null,
"desc":"购方税号",
"content":""
},
{
"nID":null,
"index":null,
"desc":"销方税号",
"content":""
},
{
"nID":null,
"index":null,
"desc":"金额",
"content":""
},
{
"nID":null,
"index":null,
"desc":"税额",
"content":""
},
{
"nID":null,
"index":null,
"desc":"合计金额",
"content":""
},
{
"nID":null,
"index":null,
"desc":"校验码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"二维码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"密文",
"content":""
},
{
"nID":null,
"index":null,
"desc":"购方名称",
"content":""
},
{
"nID":null,
"index":null,
"desc":"销方名称",
"content":""
},
{
"nID":null,
"index":null,
"desc":"大写金额",
"content":""
},
{
"nID":null,
"index":null,
"desc":"购方地址、电话",
"content":""
},
{
"nID":null,
"index":null,
"desc":"购方开户行及账号",
"content":""
},
{
"nID":null,
"index":null,
"desc":"销方地址、电话",
"content":""
},
{
"nID":null,
"index":null,
"desc":"销方开户行及账号",
"content":""
},
{
"nID":null,
"index":null,
"desc":"收款人",
"content":""
},
{
"nID":null,
"index":null,
"desc":"复核",
"content":""
},
{
"nID":null,
"index":null,
"desc":"开票人",
"content":""
},
{
"nID":null,
"index":null,
"desc":"备注",
"content":""
},
{
"nID":null,
"index":null,
"desc":"发票联",
"content":""
},
{
"nID":null,
"index":null,
"desc":"明细内容",
"content":""
},
{
"nID":null,
"index":null,
"desc":"印刷发票代码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"印刷发票号码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"票据属性",
"content":""
},
{
"nID":null,
"index":null,
"desc":"二维码发票代码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"二维码发票号码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"指定区域二维码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"发票综合代码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"发票综合号码",
"content":""
},
{
"nID":null,
"index":null,
"desc":"是否有印章",
"content":""
},
{
"nID":null,
"index":null,
"desc":"发票类型",
"content":""
}]
}]
}
机动车发票:
{
"message": {
"status": 0,
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20094",
"items": [
{
"nID": null,
"index": null,
"desc": "税控码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "机器编号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票日期",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方税号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "主管税务机关代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方税号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "税率",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "车架号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "价税合计",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "税额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "大写金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方名称",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方名称",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方身份证号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "车辆类型",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "厂牌型号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "产地",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "合格证号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "进口证明",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "商检单号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发动机号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "电话",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "账号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "地址",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开户行",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "主管税务机关",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "限乘人数",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票人",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "不含税金额小写",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票类型",
"content": "机动车销售统一发票"
}
]
}
]
}
火车票:
{
"message": {
"status": "0",
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20092",
"items": [
{
"nID": null,
"index": "null",
"desc": "车次",
"content": "",
},
{
"nID": null,
"index": "null",
"desc": "出发站",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "终点站",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "日期",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "时间",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "座位",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "座位类型",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "票价",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "证件号码",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "姓名",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "编号",
"content": ""
},
{
"nID": null,
"index": "null",
"desc": "发票类型",
"content": "火车票"
}
]
}
]
}
PDF电子发票:
{
"message": {
"status": 0,
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20093",
"items": [
{
"nID": null,
"index": null,
"desc": "发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票日期",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "机器编号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方税号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方税号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "税额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "合计金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "校验码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "二维码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "密文",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方名称",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方名称",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "大写金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方地址、电话",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "购方开户行及账号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方地址、电话",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销方开户行及账号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "收款人",
"content": "刘杰"
},
{
"nID": null,
"index": null,
"desc": "复核",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票人",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "备注",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票联",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "明细内容",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "印刷发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "印刷发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "票据属性",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "二维码发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "二维码发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票类型",
"content": "PDF电子发票"
}
]
}
]
}
定额发票:
{
"message": {
"status": 0,
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20095",
"items": [
{
"nID": null,
"index": null,
"desc": "发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "票面金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "公司印章",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "省份",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "城市",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票类型",
"content": "定额发票"
}
]
}
]
}
出租车发票:
{
"message": {
"status": 0,
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20096",
"items": [
{
"nID": null,
"index": null,
"desc": "发票代码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "所属行政区名称",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票日期",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "票面金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "上车时间",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "下车时间",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "里程",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "省份",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "城市",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "车牌号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票类型",
"content": "出租车发票"
}
]
}
]
}
航空运输电子客票行程单:
{
"message": {
"status": 0,
"value": "识别完成"
},
"cardsinfo": [
{
"type": "20097",
"items": [
{
"nID": null,
"index": null,
"desc": "乘客姓名",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "乘客证件号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "印刷序号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "电子客票号码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "校验码",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "开票日期",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "填开单位",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "销售单位代号",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "合计金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "合计税额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "燃油附加费",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "民航发展基金",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "保险费",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "航班信息",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "国内国际标签",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "票面金额",
"content": ""
},
{
"nID": null,
"index": null,
"desc": "发票类型",
"content": "航空运输电子客票行程单"
}
]
}
]
}
剩余条数查询接口(所有产品类型)
接口地址: | https://netocr.com/api/accountLift.do |
接口调用方法: | post |
接口接收参数: | |
String key: | 用户ocrKey |
String secret: | 用户ocrSecret |
String format: | 返回格式(xml或者json),如果format为空,则默认返回xml |
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 增值税发票识别API开发文档、发票ocr
发表评论 取消回复