更新时间:2026-11-02 GMT+08:00
分享

开始使用

开通文字识别 OCR服务

  1. 本方案基于华为云文字识别 OCR增值税发票识别与发票验真技术构建,如未开通服务,请按下图所示前往文字识别 OCR主页开通。

    图1 开通服务

通过华为云控制台使用

  1. 登录华为云对象存储服务控制台,选择用于上传和存储发票文件的OBS桶,上传发票图片或者电子发票pdf文件。

    图2 上传待识别发票文件

  2. 选择用于存放结果的OBS桶,即可自动获取该发票的识别与验真结果,结果为发票文件名称为前缀的JSON文件。

    图3 获取识别结果文件

通过对象存储服务OBS SDK使用

企业业务系统可通过华为云提供的SDK服务与OBS桶进行对接,当员工上传发票图片或者电子发票PDF文件到华为云OBS桶后,即可自动进行文字识别和验真,企业业务系统只需定时从存储结果的OBS桶中获取结果,即可实现发票报销的自动化处理流程。SDK详细使用流程可参考华为云官网SDK用户指南。

结果示例

  • 示例发票:(注:本示例发票不能用于测试)
    图4 示例发票
  • 发票识别与验真结果如下所示,'status'字段为'valid',表示该发票有效,返回参数的详细介绍,请参见华为云官网API参考:
{
    "result": {
        "type": "electronic",
        "serial_number": null,
        "attribution": null,
        "supervision_seal": null,
        "code": "061002301111",
        "machine_number": null,
        "print_number": null,
        "check_code": "849xxxxx77",
        "number": "1xxx682",
        "issue_date": "2023年08月04 日",
        "encryption_block": "/**......46+59",
        "buyer_name": "xxxxx有限公司",
        "buyer_id": "9xxxxxxx0D",
        "buyer_address": "",
        "buyer_bank": "",
        "seller_name": "xxxxxxx公司",
        "seller_id": "91xxxxxxP",
        "seller_address": "陕西省xxx",
        "seller_bank": "招商xxxxxx",
        "subtotal_amount": "¥328.30",
        "subtotal_tax": "¥19.70",
        "total": "¥348.00",
        "total_in_words": null,
        "remarks": null,
        "receiver": null,
        "reviewer": null,
        "issuer": null,
        "seller_seal": null,
        "item_list": [
            {
                "name": "*餐饮服务*餐费",
                "specification": "",
                "unit": "",
                "quantity": "1",
                "unit_price": "412.2641509434",
                "license_plate_number": null,
                "amount": "412.26",
                "tax_rate": "6%",
                "tax": "24.74",
                "end_date": null,
                "start_date": null,
                "vehicle_type": null
            },
            {
                "name": "*餐饮服务*餐费",
                "specification": "",
                "unit": "",
                "quantity": "",
                "unit_price": "",
                "license_plate_number": null,
                "amount": "-83.96",
                "tax_rate": "6%",
                "tax": "-5.04",
                "end_date": null,
                "start_date": null,
                "vehicle_type": null
            }
        ],
        "confidence": null
    },
    "verification_result": {
        "result": {
            "type": "vat_normal_electronic",
            "code": "061xxxxxxxx",
            "number": "1xxxxxx2",
            "issue_date": "20xxxxx04",
            "machine_number": "66xxxxxxx791",
            "check_code": "84xxxxxxxxxxx77",
            "status": "valid",
            "subtotal_amount": "328.30",
            "subtotal_tax": "19.70",
            "total": "348.00",
            "total_in_words": "叁佰肆拾捌元整",
            "remarks": "",
            "receiver": "",
            "issuer": "",
            "reviewer": "",
            "buyer_name": "xxxx有限公司",
            "buyer_id": "913xxxxxxxxxxxx20D",
            "buyer_address": "",
            "buyer_bank": "",
            "seller_name": "xxxxxxxx有限公司",
            "seller_id": "9xxxxxxx8P",
            "seller_address": "陕西省xxxxxxxx",
            "seller_bank": "招商xxxxxxxxx",
            "deductible_toll": "N",
            "items": [
                {
                    "name": "*餐饮服务*餐费",
                    "specification": "",
                    "unit": "",
                    "quantity": "1.00000000",
                    "unit_price": "412.2641509",
                    "amount": "412.26",
                    "tax_rate": "0.06",
                    "tax": "24.74",
                    "license_plate_number": "",
                    "vehicle_type": "",
                    "start_date": "",
                    "end_date": ""
                },
                {
                    "name": "*餐饮服务*餐费",
                    "specification": "",
                    "unit": "",
                    "quantity": "",
                    "unit_price": "",
                    "amount": "-83.96",
                    "tax_rate": "0.06",
                    "tax": "-5.04",
                    "license_plate_number": "",
                    "vehicle_type": "",
                    "start_date": "",
                    "end_date": ""
                }
            ],
            "result_code": "1000",
            "result_message": "The invoice verification information is consistent with the tax authority’s information."
        }
    }
}

相关文档