票据创建

  • url:/common/invoice/create
  • method:post
  • 数据格式:json

说明

  • 单个票据创建接口。
  • 接口只处理发票识别和查验成功的数据。
  • 创建增值税发票的时候需要查验结果,即receipt_check不能为空。
  • 创建增值税票据的时候需要保持识别结果中的票据类型和查验结果中的票据类型一致。 即invoices中的invoice_type和receipt_check的invoice_type必须一致
  • 传递识别查验后的票据信息到此接口,系统将创建一条消费记录和票据记录, 并将二者进行关联。
  • 接口处理发票文件验签,请配置好相关文件验签配置。
  • 接口处理税额相关计算,请配置好相关税额配置。
  • 接口会进行发票抬头校验,请配置好相关发票抬头校验配置。
  • 接口会检查是否重复导入,对于重复导入票据会记录查验失败和错误信息invoice_message。

请求参数

不同发票类型具有不同发票信息, 有些字段是否要填依据具体情况而定。
字段类型和长度限制可参照java类型。例Date: 2022-07-21T17:07:42.000Z

字段名称 字段类型 字段描述 是否必填 长度限制
bizId String 业务唯一识别码 true 36
timestamp Long 当前次接口同步时间对应的时间戳 true 13
user_code String 用户code true NA
receipt_ocr Object 票据识别后的信息 true NA
receipt_check Object 票据查验后的信息 false NA

data.receipt_ocr字段详情

字段名称 字段类型 字段描述 是否必填
version String 版本号 false
result Integer 识别请求状态. 1:成功, 0:失败 true
error String 错误码 false
message String 错误信息说明 false
time_cost String 识别花费的时长,单位毫秒 false
invoices Object Array 发票具体信息,只接受一张发票信息 ture

上表中 invoices字段详情

字段名称 字段类型 字段描述 是否必填
image_size []Integer 图片分辨率 false
attachment_url String 文件地址 true
invoice_type String 发票类型,可选值参见票据类型 true
direction Integer 发票顺时针旋转方向 false
region []Integer 单张发票区域: 左上点 和 右下点[x1, y1, x2, y2] false
invoice_code String 印刷发票代码 / 车次(类型为火车票) false
amount BigDecimal 不含税金额 false
tax_amount BigDecimal 税额 false
total_amount BigDecimal 价税合计 true
subtotal_amount BigDecimal 小计 false
highway_flag String 高速标识(Y/N) false
tax_rate BigDecimal 税率 false
invoice_number String 印刷发票号码 false
receipt_date String 开票日期 格式 yyyyMMdd receiptDate 必填的票据类型
remark String 备注 (长度不超过1024) false
title String 标题 false
check_code String 校验码 false
agent_mark String 是否代开 false
buyer_name String 购买方名称 false (票据类型为67、68时必填)
buyer_tax_code String 购买方纳税人识别号 false
seller_name String 销售方名称 false
seller_tax_code String 销售方纳税人识别号 false
currency String 币种 设置顺序:1.取入参 2.取公司配置 3.默认CNY false (如果填写,则要求是系统支持的币种)
purchase_invoice String 是否采购发票 Y/N false
buyer_bank String 开户银行 false
other_info String 其他信息 false
start_time String 开始时间 HH:mm 出租车票 ###
end_time String 结束时间 HH:mm 出租车票 ###
mileage BigDecimal 里程 ###
destination_city String 起点 ###
destination_city_to String 终点 ###
train_class String 座位类型 ###
train_number String 车次 ###
start_datetime String 乘车时间 HH:mm 火车票 ###
name String 乘车人姓名 ###
id_card String 乘车人身份证号 ###
fare BigDecimal 票价 ###
fuel_surcharge BigDecimal 燃油附加费 ###
civil_avn_dev_fund BigDecimal 民航发展基金 ###
other_taxes BigDecimal 其它税费 ###
insurance BigDecimal 保险费 ###
international_flag String 国内国际航班标志位 (D:国内飞机票 , I:国际飞机票) ###
error_num_flag Boolean 发票号码是否存在错误 ###
flight_detail Object Array 航班信息 ###
company_seal String 是否有公司印章(N: 没有; Y: 有) ###

上表中 flight_detail字段详情

字段名称 字段类型 字段描述 是否必填
from String 出发站 ###
to String 到达站 ###
time String 乘机时间 (格式: HH:mm) ###
date String 乘机日期 ###
seat String 座位等级 ###
flight_class String 舱位 头等舱/公务舱/经济舱/超级经济舱 ###
class_name String 舱位等级 ###
flight_number String 航班号 ###

data中data.receipt_check字段详情

字段名称 字段类型 字段描述 是否必填
result Integer 请求状态. 1:成功 false
error String 错误码 false
message String 信息说明 false
check_date Date 最后查验日期 false
invoice_type String 发票类型,可选值见票据类型 false
invoice_code String 发票代码 false
invoice_num String 发票号码 false
receipt_date Date 发票日期 false
check_code String 校验码 false
total_amount BigDecimal 价税合计 false
amount BigDecimal 金额 false
tax_amount BigDecimal 税额 false
remark String 备注 false
buyer_name String 购方名称 false
buyer_tax_code String 购方税号 false
buyer_address_phone String 购方地址、电话 false
buyer_account String 购方开户行及账号 false
seller_name String 销方名称 false
seller_tax_code String 销方税号 false
seller_address_phone String 销方地址、电话 false
seller_account String 销方开户行及账号 false
cancellation_mark String 作废标识 false
detail_list Object Array 明细行 false

上表中 detail_list字段详情

字段名称 字段类型 字段描述 是否必填
name String 货物名称 false
specification String 规格型号 false
unit String 单位 false
total_amount BigDecimal 价税合计 false
amount BigDecimal 金额 false
tax_amount BigDecimal 税额 false
price BigDecimal 不含税单价 false
quantity BigDecimal 数量 false
tax_rate BigDecimal 税率 false

返回参数

字段名称 字段类型 字段描述
resCode Integer 响应状态码(见附录)
resMsg String 返回信息描述
data.expense_id Long 此次请求产生的expense id
data.invoice_message String 业务校验产生的错误信息
data.invoice_message_code String 业务校验产生的错误信息编码
data.invoice_status String 票据状态: Y(已验真),F(查验失败),C(待查验),R(识别中),U(无法识别),I(已识别)

请求示例

{
  "bizId": "1659685330206",
  "timestamp": 1659685330206,
  "user_code": "sss.ddd",
  "receipt_ocr": {
    "result": 1,
    "error": null,
    "message": "success",
    "time_cost": "1360",
    "version": "20201023",
    "invoices": [
      {
        "image_size": [720, 1280],
        "attachment_url": "22067/2022/07-22/receipt/04a8454b-8815-4df0-b2b0-de0d8b46d48a.jpg",
        "invoice_type": "10",
        "direction": 3,
        "region": [0, 75, 720, 1280],
        "invoice_code": "033022100211",
        "amount": 250,
        "tax_amount": 0,
        "total_amount": 250,
        "invoice_number": "68552329",
        "receipt_date": "20220627",
        "remark": "JIHAIR0NGv.2225/219359778//CHATT0GRAM/",
        "title": "宁波增值税电子普通发票",
        "check_code": "58053893572132760108",
        "agent_mark": null,
        "buyer_name": "快舱(江苏)供应链管理有限公司常州分公司",
        "buyer_tax_code": "91320402MA1YA9ELXL",
        "seller_name": "宁波港东南扬子江物流有限公司",
        "seller_tax_code": "91330212MA2J5RER99",
        "start_time": null,
        "end_time": null,
        "mileage": null,
        "destination_city": null,
        "destination_city_to": null,
        "train_class": null,
        "train_number": null,
        "start_datetime": null,
        "name": null,
        "id_card": null,
        "currency": null,
        "fare": null,
        "fuel_surcharge": null,
        "error_num_flag": null,
        "international_flag": null,
        "flight_detail": null,
        "purchase_invoice": null
      }
    ]
  },
  "receipt_check": {
    "result": 1,
    "error": null,
    "message": null,
    "check_date": "2022-07-21T17:07:42.000Z",
    "invoice_type": "10",
    "invoice_code": "033022100211",
    "invoice_num": "68552329",
    "receipt_date": "2022-06-27T00:00:00.000Z",
    "check_code": "58053893572132760108",
    "total_amount": 250,
    "amount": 250,
    "tax_amount": 0,
    "remark": "JI HAI RONG v.2225 / 219359778 /  / CHATTOGRAM /",
    "buyer_name": "快舱(江苏)供应链管理有限公司常州分公司",
    "buyer_tax_code": "91320402MA1YA9ELXL",
    "buyer_address_phone": "常州市天宁区关河东路66号1906室0519-88761158",
    "buyer_account": "中国银行常州天宁支行营业部513173202341",
    "seller_name": "宁波港东南扬子江物流有限公司",
    "seller_tax_code": "91330212MA2J5RER99",
    "seller_address_phone": "宁波市鄞州区昌乐路258号东南物流大厦501-2室0574-87096741",
    "seller_account": "中国银行宁波市分行RMB355879523118",
    "cancellation_mark": "N",
    "repeat_flag": null,
    "detail_list": [
      {
        "name": "*经纪代理服务*国际货物运输代理服务费",
        "specification": "",
        "unit": "票",
        "total_amount": 250,
        "amount": 250,
        "tax_amount": 0,
        "price": 250,
        "quantity": 1,
        "tax_rate": 0
      }
    ]
  }
}

返回示例

{
  "resCode": 200000,
  "resMsg": "success",
  "bizId": "1659685478833",
  "data":{
    "expense_id": 41981033,
    "invoice_message": "发票已导入",
    "invoice_message_code": 907002,
    "invoice_status": "F"
  } 
}

日期必填票据类型

invoiceType:01, 02, 03, 04, 08, 10, 11, 14, 15, 18, 19, 20, 21, 67, 68

几种票据类型私有字段

票据类型 说明 涉及字段应该必填
60 火车票 destination_city,
destination_city_to,
train_number,
train_class
61 出租车发票 start_time (格式:HH:mm),
end_time (格式:HH:mm),
mileage
63 过路费发票 destination_city,
destination_city_to
65 航空运输电子客票行程单 flight_detail相关字段,
fare,
fuel_surcharge,
id_card,
international_flag (I:国际航空票,D:国内航空票)
51 定额发票 company_seal (Y/N)

results matching ""

    No results matching ""