票据同步识别与查验

  • url:/common/InvoiceOCR/ocrSyncWithConfig
  • method:post
  • 数据格式:json

说明

  • 该接口使用前联系产品开通发票识别与查验的子账号,然后点击配置
  • 子账号识别限制1张文件不超过3张发票数据
  • 同步进行识别和查验,建议超时时间设置在60s以上

请求参数

字段名称 字段类型 字段描述 是否必填 长度限制 说明
bizId String 业务唯一识别码 true 36
timestamp Long 当前次接口同步时间对应的时间戳 true 13
attachment_url String 文件地址 true NA
purchase_invoice String 是否采购发票 true NA Y / N (不传默认为N)
create_expense Object 是否创建消费记录 false NA Y / N (不传默认为N)
user_code String 工号 (employee_number) false NA 当create_expense为Y时必传

返回参数

字段名称 字段类型 字段描述
resCode Integer (200000:成功) 识别查验失败:错误编码
resMsg String 返回信息描述
data.ocr_result Object 识别返回
data.check_result Object 查验返回
data.expense_result Object 创建消费记录返回

data.expense_result

字段名称 字段类型 字段描述
expense_result.expense_id Long 此次请求产生的expense id
expense_result.invoice_message String 业务校验产生的错误信息
expense_result.invoice_message_code String 业务校验产生的错误编码
expense_result.invoice_status String 发票状态

请求示例 (当无需创建消费记录时)

{
  "data": {
    "attachment_url": "21774/2024/11-26/out/a56b2e18-e1b3-4164-8e58-9ff8b77a6afd.pdf",
    "purchase_invoice": "N"
  },
  "bizId": "dbc64bb9-98cd-4adf-ab80-945573a80759",
  "timestamp": 1727247523662
}

请求示例 (当需创建消费记录时)

{
  "data": {
    "attachment_url": "21774/2024/11-26/out/a56b2e18-e1b3-4164-8e58-9ff8b77a6afd.pdf",
    "purchase_invoice": "N",
    "create_expense": "Y",
    "user_code": "903851"
  },
  "bizId": "dbc64bb9-98cd-4adf-ab80-945573a80759",
  "timestamp": 1727247523662
}

返回示例 (当没配置秘钥时)

{
    "resCode": 400000,
    "resMsg": "配置校验失败,请预先配置识别秘钥"
}

返回示例 (当不需创建消费记录时)

{
  "resCode": 200000,
  "resMsg": "success",
  "data": [
    {
      "ocr_result": {
        "source": "interface",
        "source_file": "Y",
        "invoice_input": "{\"No\":\"26317000000552768706\",\"Code\":null,\"VCode\":\"\",\"Amount\":43.50,\"Date\":\"20260205\"}",
        "invoice_type": "21",
        "invoice_status": "R",
        "invoice_attachments": "[{\"original_url\":\"21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf\",\"location\":{\"direction\":\"0\"},\"created_by\":0,\"attachment_url\":\"21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf\",\"direction\":\"0\"}]",
        "log_id": 1825818122664084104,
        "invoice_num": "26317000000552768706",
        "invoice_serial": "",
        "amount": 43.50,
        "currency": "CNY",
        "tax_amount": 1.27,
        "receipt_date": 1770220800000,
        "buyer_name": "上海云简软件科技有限公司",
        "buyer_tax_code": "913101123325776235",
        "seller_name": "上海滴滴畅行科技有限公司",
        "seller_tax_code": "91310114MA1GW61J6U",
        "name": "电子发票(普通发票)",
        "shop_name": "上海滴滴畅行科技有限公司",
        "status": "0",
        "abnormal_status": "0",
        "invoice_detail": "{\"Status\":0,\"No\":\"26317000000552768706\",\"Amount\":42.23,\"SummaryAmount\":43.50,\"Buyer\":{\"TaxCode\":\"913101123325776235\",\"AccountBank\":\"招商银行股份有限公司上海浦江镇支行 121916050910201\",\"AddressPhone\":\"上海市闵行区东川路555号丁楼7081室 02164285359\",\"Name\":\"上海云简软件科技有限公司\"},\"Date\":\"2026-02-05 00:00:00\",\"Remark\":\"购方开户银行:招商银行股份有限公司上海浦江镇支行 银行账号:121916050910201 购方地址:上海市闵行区东川路555号丁楼7081室 电话:02164285359\",\"TaxAmount\":1.27,\"Saler\":{\"TaxCode\":\"91310114MA1GW61J6U\",\"AccountBank\":\"\",\"AddressPhone\":\"\",\"Name\":\"上海滴滴畅行科技有限公司\"},\"invoiceType\":\"21\",\"Items\":[{\"TaxAmount\":1.27,\"Price\":42.23,\"Amount\":42.23,\"TaxRate\":3,\"Quantity\":1,\"Specification\":\"\",\"Unit\":\"\",\"Name\":\"*运输服务*客运服务费\"}],\"VCode\":\"\"}",
        "items": "[{\"amount\":42.23,\"material_name\":\"*运输服务*客运服务费\",\"name\":\"*运输服务*客运服务费\",\"price\":42.23,\"quantity\":1,\"specification\":\"\",\"taxAmount\":1.27,\"taxRate\":3,\"unit\":\"\"}]",
        "valid_amount": 43.50,
        "attachment_url": "21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf"
      },
      "check_result": {
        "result": 1,
        "invoice_type": "21",
        "buyer_name": "上海云简软件科技有限公司",
        "buyer_tax_code": "913101123325776235",
        "seller_name": "上海滴滴畅行科技有限公司",
        "seller_tax_code": "91310114MA1GW61J6U",
        "invoice_code": "",
        "invoice_number": "26317000000552768706",
        "total_amount": 43.5,
        "amount": 42.23,
        "tax_amount": 1.27,
        "receipt_detail_list": [
          {
            "item_name": "*运输服务*客运服务费",
            "specification": "无",
            "unit": "次",
            "quantity": 1,
            "unit_price": 42.23,
            "amount": 42.23
          }
        ]
      }
    }
  ]
}

返回示例 (当需创建消费记录时)

{
  "resCode": 200000,
  "resMsg": "success",
  "data": [
    {
      "ocr_result": {
        "source": "interface",
        "source_file": "Y",
        "invoice_input": "{\"No\":\"26317000000552768706\",\"Code\":null,\"VCode\":\"\",\"Amount\":43.50,\"Date\":\"20260205\"}",
        "invoice_type": "21",
        "invoice_status": "R",
        "invoice_attachments": "[{\"original_url\":\"21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf\",\"location\":{\"direction\":\"0\"},\"created_by\":0,\"attachment_url\":\"21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf\",\"direction\":\"0\"}]",
        "log_id": 1825818122664084105,
        "invoice_num": "26317000000552768706",
        "invoice_serial": "",
        "amount": 43.50,
        "currency": "CNY",
        "tax_amount": 1.27,
        "receipt_date": 1770220800000,
        "buyer_name": "上海云简软件科技有限公司",
        "buyer_tax_code": "913101123325776235",
        "seller_name": "上海滴滴畅行科技有限公司",
        "seller_tax_code": "91310114MA1GW61J6U",
        "name": "电子发票(普通发票)",
        "shop_name": "上海滴滴畅行科技有限公司",
        "status": "0",
        "abnormal_status": "0",
        "invoice_detail": "{\"Status\":0,\"No\":\"26317000000552768706\",\"Amount\":42.23,\"SummaryAmount\":43.50,\"Buyer\":{\"TaxCode\":\"913101123325776235\",\"AccountBank\":\"招商银行股份有限公司上海浦江镇支行 121916050910201\",\"AddressPhone\":\"上海市闵行区东川路555号丁楼7081室 02164285359\",\"Name\":\"上海云简软件科技有限公司\"},\"Date\":\"2026-02-05 00:00:00\",\"Remark\":\"购方开户银行:招商银行股份有限公司上海浦江镇支行 银行账号:121916050910201 购方地址:上海市闵行区东川路555号丁楼7081室 电话:02164285359\",\"TaxAmount\":1.27,\"Saler\":{\"TaxCode\":\"91310114MA1GW61J6U\",\"AccountBank\":\"\",\"AddressPhone\":\"\",\"Name\":\"上海滴滴畅行科技有限公司\"},\"invoiceType\":\"21\",\"Items\":[{\"TaxAmount\":1.27,\"Price\":42.23,\"Amount\":42.23,\"TaxRate\":3,\"Quantity\":1,\"Specification\":\"\",\"Unit\":\"\",\"Name\":\"*运输服务*客运服务费\"}],\"VCode\":\"\"}",
        "items": "[{\"amount\":42.23,\"material_name\":\"*运输服务*客运服务费\",\"name\":\"*运输服务*客运服务费\",\"price\":42.23,\"quantity\":1,\"specification\":\"\",\"taxAmount\":1.27,\"taxRate\":3,\"unit\":\"\"}]",
        "valid_amount": 43.50,
        "attachment_url": "21774/2026/03-20/receipt/b9d489c7-10d1-46e9-8953-359237f51893.pdf"
      },
      "check_result": {
        "result": 1,
        "invoice_type": "21",
        "buyer_name": "上海云简软件科技有限公司",
        "buyer_tax_code": "913101123325776235",
        "seller_name": "上海滴滴畅行科技有限公司",
        "seller_tax_code": "91310114MA1GW61J6U",
        "invoice_code": "",
        "invoice_number": "26317000000552768706",
        "total_amount": 43.5,
        "amount": 42.23,
        "tax_amount": 1.27,
        "receipt_detail_list": [
          {
            "item_name": "*运输服务*客运服务费",
            "specification": "无",
            "unit": "次",
            "quantity": 1,
            "unit_price": 42.23,
            "amount": 42.23
          }
        ]
      },
      "expense_result": {
        "expense_id": 387278780,
        "invoice_status": "Y"
      }
    }
  ]
}

results matching ""

    No results matching ""