News Details

How are invoice files generated via the Leqi interface? — Pass in Leqi standard messages to directly output PDF, OFD, and XML layout files

Published on: 2024-11-19 16:59

To meet the multi-scenario, large-scale, compliant, and automated electronic invoice issuance needs of Leqi Direct Connection taxpayers, the Leqi Digital Open Platform provides format files and XML generation specifications for fully digitalized e-invoices. Leqi Direct Connection units generate the format and XML electronic files of digitalized electronic invoices in their own business systems in accordance with these specifications and deliver them.


During Leqi invoicing, XML files and PDF and OFD layout files must be assembled and generated by the enterprise itself, so there are certain technical capability requirements for enterprises.

Kailing Leqi front-end platformEquipped with mature format capabilities, with all Leqi format files and XML generation specifications built in, automatically matching and generating format files (PDF format files, OFD format files) according to different label elements, and can separately open interfaces for integration by other business systems, saving the development/testing workload of other business systems.

Through the Kailing Leqi front-end platform, enterprises can not only issue fully digitalized e-invoices in XML format that meet tax bureau requirements, but also generate preview versions of fully digitalized e-invoices in OFD and PDF formats. In cases where enterprises only receive fully digitalized e-invoices in XML format, it can also help generate preview versions in OFD and PDF formats for easy viewing by finance personnel.


Some invoice layout file specificationsApplicable to Leqi Direct Connection units generating basic-version fully digitalized e-invoices and specific-element invoice layout files and XML format files. Direct connection units may not generate specific-element invoices using the basic-version layout and XML format.

For example:A certain Leqi Direct Connection unit, Company A, subscribed on the Leqi platform to the digital electronic invoice (basic version) issuance capability and authorized this capability to its bound user unit, Company B. When generating the digital electronic invoice layout document and XML for Company B, the basic version style and XML format information of this specification should be used.


Leqi direct connection units generate fully digitalized e-invoice layout files in PDF or OFD format. Fully digitalized e-invoice layout files are only used as a display form of invoice data. When purchaser taxpayers use fully digitalized e-invoices for VAT deduction or refund selection, the invoice data received in their digital accounts shall prevail. When taxpayers use fully digitalized e-invoices as electronic vouchers for computerized accounting, they shall comply with the relevant requirements of the Ministry of Finance and the National Archives Administration.

Leqi direct connection units may design delivery methods for fully digitalized e-invoice layout files and XML according to specific business scenarios and the technical implementation methods of their own business systems, and may not make the recipient's performance of other additional obligations a precondition for receiving fully digitalized e-invoice layout files and XML.


(1) Fully Digitalized E-invoice (Basic Version)

The fonts and font sizes involved in the layout file specification are limited to information displayed on the invoice face and do not involve filled information.

Suggested font and size for filling in information: purchaser/seller taxpayer identification number: Courier New 12pt; RMB symbol Courier
New, 11pt; the rest in SimSun 9pt. The filled information display can be adjusted by wrapping and shrinking according to the filled data. The layout delivery time and upload time must not differ by 48 hours.


1. 1 Format Specification

The face dimensions of a fully digitalized e-invoice (displayed at 100%) are 210 mm in length and a minimum height of 140 mm. The dimensions are fixed and vertically divided into five parts: invoice header, seller and buyer, taxable details and totals, remarks, and invoice footer. The inner frame excluding the invoice header and footer measures 201 mm in length and 94 mm in height. When printing, all content within the layout may be enlarged or reduced proportionally. When printing reduced, it should be ensured that the invoice page content is clear and readable.

When the invoice line item information does not exceed 8 lines, the invoice height is 140mm; when the invoice line item information exceeds 8 lines, the invoice height is 140mm plus the height of the invoice line items exceeding 8 lines.


1 Format Specification



Add color band rules to the right box of the invoice face:

Add a gold color band (RGB: R246, G237, B225) and a coffee color band (RGB: R118, G89, B84) below the 1/2 position of the right box line, both with a height of 0.54mm and a length of 1/2 of the right box line (as shown in the figure below).


1 Format Specification


The supervision seal of a fully digitalized e-invoice is oval in shape, measuring 30 mm in length and 20 mm in height (displayed at 100%). The dimensions are fixed, and the outer ring is 1 mm high. A thin line is engraved inside the inner ring; the upper ring is engraved with the words "National Uniform Invoice Supervision Seal," the middle is engraved with the words "State Taxation Administration," and the lower ring is engraved with the words "xx Provincial (Region, Municipality) Tax Service." The font is KaiTi 7 pt, and the ink color is bright red.



1 Format Specification

All fonts of the supervision seal are regular script
7
Pound, printed in bright red



(II) Fully digitalized electronic invoices (self-produced agricultural product sales/agricultural product procurement/photovoltaic procurement/rare earth/refined oil/cigarettes/e-cigarettes)

Must have invoicing qualifications for self-produced agricultural product sales/agricultural product acquisition/photovoltaic acquisition/rare earth/refined oil/cigarettes/e-cigarettes, and after issuing the corresponding invoices within the validity period of the qualification, use the following rules to generate layout files.

The fonts and font sizes involved in the layout file specification are limited to information displayed on the invoice face and do not involve filled information.

Suggested font and size for filling in information: purchaser/seller taxpayer identification number: Courier New 12pt; RMB symbol Courier
New, 11pt; the rest in SimSun 9pt. The filled information display can be adjusted by wrapping and shrinking according to the filled data. The layout delivery time and upload time must not differ by 48 hours.


2. 1 Format specification

The face dimensions of a fully digitalized e-invoice (displayed at 100%) are 210 mm in length and a minimum height of 140 mm. The dimensions are fixed and vertically divided into five parts: invoice header, seller and buyer, taxable details and totals, remarks, and invoice footer. The inner frame excluding the invoice header and footer measures 201 mm in length and 94 mm in height. When printing, all content within the layout may be enlarged or reduced proportionally. When printing reduced, it should be ensured that the invoice page content is clear and readable.

When the invoice line item information does not exceed 8 items, the invoice height is 140mm; when the invoice line item information exceeds 8 items, the invoice height is 140mm plus the height of the invoice line items exceeding 8 items.

1 Format specification

Add color band rules to the right box of the invoice face:

Add a gold color band (RGB: R246, G237, B225) and a coffee color band (RGB: R118, G89, B84) below the 1/2 position of the right box line, both with a height of 0.54mm and a length of 1/2 of the right box line (as shown in the figure below).


1 Format specification


The supervision seal of a fully digitalized e-invoice is oval in shape, measuring 30 mm in length and 20 mm in height (displayed at 100%). The dimensions are fixed, and the outer ring is 1 mm high. A thin line is engraved inside the inner ring; the upper ring is engraved with the words "National Uniform Invoice Supervision Seal," the middle is engraved with the words "State Taxation Administration," and the lower ring is engraved with the words "xx Provincial (Region, Municipality) Tax Service." The font is KaiTi 7 pt, and the ink color is bright red.

1 Format specification


All fonts of the supervision seal are regular script
7
Pound, printed in bright red


For other special label layout files, please refer to the latest Leqi specification documents.



ThreeSome invoice validation rules

1. General verification for red-letter and blue-letter invoices

▪ Validation that message parameter information meets length or non-empty requirements (validation of input parameters listed in the capability description document).

▪ Identity information validation: validate whether the tax number bound to the Leqi ID is consistent with the invoicing taxpayer identification number.

▪ Goods and services name concatenation rule validation: *abbreviation of tax classification code* + project name.

▪ Validation of the invoice date against the first 2 digits of the invoice number.

▪ The purchaser's taxpayer identification number on a special VAT invoice cannot be empty.

▪ When the buyer's natural person flag is Y, validate whether the buyer's taxpayer name ends with "(Individual)".

▪ Validation that detail sequence numbers increase as natural numbers.

▪ Compliance verification of invoice face information (the total amount including tax should satisfy |total amount + total tax = total amount including tax. Single-line amount verification |unit price * quantity - amount| <= 0.01. Amount summary verification |sum of tax-exclusive amounts of all commodity lines - total amount| <= 0.01).

▪ Validation of sequentially increasing discount line order.

▪ Quantity and unit price must be either both empty or both non-empty.

▪ Differential taxation and general taxation verification (tax-inclusive amount reverse calculation verification; the error in the reverse-calculated tax-inclusive amount should be less than or equal to 0.01)

▪ Differential taxation single-line tax amount verification: |(tax-inclusive amount - deduction amount)/(1+tax rate)*tax rate - tax amount| <= (blue-letter invoice 0.06, red-letter invoice 1.27)

▪ Difference taxation summary tax amount validation: |(tax-inclusive amount - deduction amount)/(1+tax rate)*tax rate - tax amount (line 1) + ... + (tax-inclusive amount - deduction amount)/(1+tax rate)*tax rate - tax amount (line N) - total tax amount| <= 1.27

▪ Single-line tax amount validation for general taxation: |Amount excluding tax * tax rate (tax-exclusive rate) - tax amount| <= 0.06

▪ Summary tax amount validation for general taxation: |Amount excluding tax * tax rate (tax-exclusive rate) (Row 1) + ... + Amount excluding tax * tax rate (Row N) - total tax amount| <= 1.27

▪ Validation comparing the unused credit limit already downloaded for the month of the invoice date with the total invoiced amount.

▪ Verify whether the invoice number is an available code assignment record downloaded by the enterprise.

▪ Validation of whether the invoicing party taxpayer is a risk taxpayer.

▪ Validate whether the tax classification code is one listed by the State Taxation Administration.

▪ Verification of issuing invoices with specified corresponding types and specific elements via the specific-element invoicing interface.

▪ Whether the invoice number has already been uploaded (number duplicate verification).

▪ When uploading invoices, invoice numbers within the same batch cannot be duplicated in verification.

▪ Total amount and total amount including tax should be positive, and total tax should be greater than or equal to 0.

▪ For multi-line details, the amount and tax-inclusive amount of normal lines or discounted lines should be positive, and the tax amount should be greater than or equal to 0.

▪ If the blue invoice issuance time is not within the validity period of the credit limit, issuance is not allowed.

▪ When issuing a blue invoice, if the remaining credit limit is insufficient, issuance is not allowed.

▪ When uploading a blue invoice, the red invoice related parameters should be empty.

▪ When uploading invoices, verify whether the code assignment segment exists (including whether it belongs to the taxpayer uploading the invoice).

▪ For difference taxation invoices, the difference taxation type code and deduction amount must both be non-empty.

▪ For differential taxation invoices, when the differential taxation type is "full-amount invoicing", the deduction amount can be filled in but does not participate in tax calculation.

▪ For difference taxation invoices, there can be only one detail line.

▪ The tax classification code used for invoice issuance cannot be a summary item.

▪ Buyer taxpayer identification number validation rule: required for special invoices, length 15 to 20 characters, consisting of digits and uppercase letters; optional for general invoices, if filled in, length 15 to 20 characters, consisting of digits and uppercase letters.


2. Red-letter invoice unique verification

Mandatory verification of red-letter related parameters (red-letter confirmation form UUID, red-letter confirmation form number, corresponding blue-letter invoice number).

▪ Verification that the relevant amount and tax amount of the red-letter invoice must be less than 0.

▪ Verification of red-letter invoice detail lines (when there is no discount line and discounted line, the corresponding blue-letter invoice sequence number cannot be empty).

▪ Verification of whether the red-letter confirmation form has already been used.

▪ Comparison and verification of the main information in the red-letter confirmation form with the main information of the red-letter invoice.

▪ The invoice type of the red-letter confirmation form does not match; issuance is not allowed.

▪ The red-letter confirmation form is invalid; issuance is not allowed.

▪ The red-letter confirmation form has already been used; issuance is not allowed.

▪ The red-letter confirmation form number does not match; issuance is not allowed.

▪ If the corresponding blue-letter invoice number is inconsistent with the blue-letter invoice number in the red-letter confirmation form, issuance is not allowed.

▪ The status of the red-letter confirmation form is not 01 or 04; issuance is not allowed.

▪ If the seller taxpayer identification number of the issued red invoice is inconsistent with that of the red-letter confirmation form, it is not allowed to be issued.

▪ If the seller name of the issued red invoice is inconsistent with that of the red-letter confirmation form, it is not allowed to be issued.

▪ If the buyer taxpayer identification number of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the buyer name of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the amount of the issued red invoice is inconsistent with the red-letter reversal amount, it cannot be issued.

▪ If the tax amount of the issued red invoice is inconsistent with the red-letter reversal tax amount, it cannot be issued.

▪ If the number of lines of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the item name of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the specification and model of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the unit of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the commodity and service tax classification code of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the quantity of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the unit price of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the amount of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the tax rate of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ If the tax amount of the issued red invoice is inconsistent with that of the red-letter confirmation form, it cannot be issued.

▪ When calling the e-invoice interface to query red confirmation slip details, the system returns an exception, blocking the upload of the red invoice.



As a comprehensive business-finance-tax digitalization solution service provider, Kailing Technology provides business-finance-tax management digital transformation products and operational services for various government agencies, institutions, and large, medium, and small enterprises. The product line includes:

Solutions for businesses including sales contract management system, procurement contract management system, fully digitalized Leqi interface project, output automatic invoicing system, employee expense control and reimbursement system, input VAT invoice management system, supply chain collaborative reconciliation system, image OCR recognition system, automatic financial bookkeeping system, and electronic accounting archives system, comprehensively driving the digitalization process across various fields.

If you have any business-finance-tax digital transformation needs, welcome to contact us. Beijing Kailing Technology will serve you wholeheartedly.

Red-letter invoice unique verification


Share to:
Contact Us

Contact: 010-60974119

VIP Dedicated Consultant: 185-1389-5936

Address: Room 410, 4th Floor, Jianjin Center, No. Jia 1 Yongtaiyuan, Qinghe, Haidian District, Beijing
Scan to add customer service on WeChat
Industry Websites
Scan to follow our WeChat official account
Scan to view our video account
Scan to follow our Douyin account
Common Questions
When the Leqi interface generates invoice files, do enterprises need to develop layout files themselves?
During Leqi invoicing, XML, PDF, and OFD layout files must be assembled and generated by the enterprise itself, which requires technical capability. However, the Kailing Leqi front-end platform has built in all Leqi layout specifications, can automatically match and generate PDF and OFD files, and opens interfaces for integration, saving enterprises development and testing work.
What formats are available for Leqi invoice layout files? What are the requirements for size and fonts?
Layout files use PDF or OFD format. The invoice face size is 210 mm long and a minimum height of 140 mm, with an inner frame 201 mm long and 94 mm high. Recommended fonts for filled information: use Courier New 12pt for the buyer's and seller's taxpayer identification numbers, Courier New 11pt for the RMB symbol, and SimSun 9pt for the rest. The error between the layout delivery time and upload time must not exceed 48 hours.
What validation rules exist when the Leqi interface generates invoices?
Verification rules include: identity information verification (Leqi ID consistent with tax number), goods and services name concatenation rule verification (*abbreviation of tax classification code* + item name), total amount including tax verification (|total amount + total tax - total amount including tax| <= 0.01), general verification for red and blue invoices, and unique verification for red-letter invoices (such as red-letter confirmation form status and amount consistency).
Can the Leqi interface generate layout files for invoices with specific elements (such as agricultural products and refined oil)?
Yes, but the enterprise must have the corresponding invoicing qualification and it must be within the validity period. Invoices with specific elements (sales of self-produced agricultural products, agricultural product purchases, photovoltaic purchases, rare earths, refined oil, cigarettes, e-cigarettes) must be generated using the corresponding format specifications and must not be generated in the basic version style. The Kailing Leqi front-end platform supports automatic matching and generation.
What are the specifications for the supervision seal and color band of Leqi invoices?
The supervision seal is oval, 30mm long and 20mm high, with "National Unified Invoice Supervision Seal" engraved on the upper ring, "State Taxation Administration" in the middle, and "xx Provincial (Autonomous Region, Municipality) Tax Service" on the lower ring, in KaiTi 7-point font, printed in bright red. Below the right frame line 1/2, add a gold color band (RGB:246,237,225) and a coffee color band (RGB:118,89,84), height 0.54mm, length right frame line 1/2.
Related solutions
Leqi Direct Connection solution
Direct connection to the tax bureau's Leqi channel, connecting the last mile of ERP →
Refined oil invoicing upon transaction
Leqi Joint Use, refueling instant invoicing, connect and go →
Enterprise Invoice Title Query
Look up the tax number by company name, complete the title information with one click →
Further Reading
Development and characteristics of the Leqi Platform
Leqi (NaturalSystem) is a platform provided by the tax system offering rule-open... →
Application guide for "Leqi Service"
The comprehensive rollout of the "fully digitalized e-invoices" pilot combined with the new technology empowerment of "Leqi Services" brings enterprises... →
National VAT Invoice Verification Platform | Invoice Query
With the promotion of China Golden Tax Phase IV, the State Taxation Administration's tax audits of enterprises are becoming increasingly refined, while... →