You need to enable JavaScript to run this app.
导航

接口文档

最近更新时间2021.12.16 13:58:38

首次发布时间2021.12.16 13:58:38

接入指引

请先查看接入指引了解具体接入方式,再参考此文档完成接入。

请求API

名称内容
请求方式POST
Content-Typeapplication/x-www-form-urlencoded
图片要求1. 图片格式:JPG、JPEG、PNG、BMP等常见格式,建议使用JPG格式。
2. 图片文件大小:最大 5 MB。

输入参数

Query参数:

参数可选/必选类型说明
Action必选String接口名,取值:OcrRollInvoice
Version必选String版本号,取值:2021-08-23

Body参数:

参数可选/必选类型说明
image_base64必选String图片base64编码

data 字段说明

字段类型说明备注
license_mainmain_info主页面信息字段说明见下方

main_info 字段说明

字段类型说明备注
seller_nameString销售方名称主页信息
buyer_nameString购买方名称主页信息
entry_{条目编号}.{明细字段}String发票条目字段说明见下方
invoice_headerString发票名称主页信息
invoice_couponString发票联主页信息
invoice_codeString发票代码主页信息
invoice_numberString发票号码主页信息
machine_codeString机器编号主页信息
typed_invoice_noString机打号码主页信息
seller_taxpayer_noString销售方纳税人识别号主页信息
invoice_dateString开票日期主页信息
payeeString收款员主页信息
buyer_taxpayer_noString购买方纳税人识别号主页信息
lowercase_total_amountString合计金额(小写)主页信息
capital_total_amountString合计金额(大写)主页信息
check_codeString校验码主页信息
seller_name_in_sealString印章中销售方名称主页信息
seller_taxpayer_no_in_sealString印章中销售方纳税人识别号主页信息

entry 明细字段说明

字段类型说明备注
entry_nameString项目主页信息
quantityString数量主页信息
price_amountString金额主页信息
unit_priceString单价主页信息

错误码

HttpCode错误码错误消息描述
20010000"Success"请求成功
40050204"Parse Request Parameters Error"缺少参数
40150205"Image Size Exceeds Maximum Limit: please compress the image"图片大小超过上限
40050207"Image Decode Error: image format unsupported"图片解码错误,文件内容为空或格式错误
40050208"Invalid Input Image: No object detected in input image, bad input image"输入图片没有检测到卷式发票
40150400见下方鉴权错误信息鉴权失败
40450402"Request URL Error"无效的请求路径
50050500"Internal Error: please contact with bytedance engineering team"内部错误,需要联系开发人员

鉴权错误信息

HttpCode错误码错误消息描述
40150400"Access Denied: api forbidden"api_key缺失或者错误
40150400"Access Denied: bad timestamp. Make sure your clock is correct"timestamp错误
40150400"Access Denied: timestamp is an invalid integer"timestamp缺失或格式错误
40150400"Access Denied: nonce is not a 32-bit signed integer"nonce缺失或格式错误
40150400"Access Denied: bad signature"sign缺失或格式错误

注: 更多通用反馈字段通用返回值和状态码

返回值示例

主页面图片返回值示例

{
   "code":10000,
   "data":{
      "license_main":{
         "seller_name":"中国石化销售有限公司上海石油分公司",
         "buyer_name":"上海今日头条科技有限公司",
         "entry_0.entry_name":"*预付卡销售*加油充值款",
         "entry_0.quantity":"1.00",
         "entry_0.price_amount":"500.00",
         "entry_0.unit_price":"500.00",
         "invoice_header":"上海增值税普通发票",
         "invoice_coupon":"发票联",
         "invoice_code":"031001750107",
         "invoice_number":"03574125",
         "machine_code":"661712116595",
         "typed_invoice_no":"03574125",
         "seller_taxpayer_no":"91310000834486035U",
         "invoice_date":"2019年1月14日",
         "payee":"高红英",
         "buyer_taxpayer_no":"91310104MA1FR7C72G",
         "lowercase_total_amount":"¥500.00",
         "capital_total_amount":"伍佰元整",
         "check_code":"70497 71434 15541 89588"
      }
   },
   "message":"Success",
   "request_id":"68885192694164377721603858375",
   "status":10000,
   "time_elapsed":"418.017944ms"
}