China Digital Invoice XML Field Verification API
Extract the invoice number, issue date and tax-inclusive amount from a Chinese digital invoice XML and submit them to the ChinaValidate field verification API.
Verify a Chinese invoice using its printed details.

A Chinese supplier sends an XML invoice and a PDF showing the same transaction. The documents reach accounts payable through different channels, and the team wants to verify the invoice before using it. The integration can retain the issued XML, read its structured invoice number, issue date and tax-inclusive amount, then submit those three values through the ChinaValidate field verification API with the correct invoice type. This keeps the issued file and the fields actually sent available to the reviewer.
The example below concerns a fully digital electronic invoice for a purchase from a Mainland Chinese supplier. Identify the document before applying the example. A structured attachment can instead describe an older VAT invoice, another type of electronic voucher or an internal accounting document. Which fields go into a verification request depends on the invoice type supported by the endpoint. ChinaValidate invoice verification requests
Identify the source before extracting values
Begin with the file the supplier actually issued. Record where it came from, when the team received it and which purchase it accompanied. Retain the received bytes and give the document a stable internal reference. A parsed representation can make the record searchable. Preserve the original so the person resolving an exception can compare it with the exact text and numbers supplied.
The Ministry of Finance provides separate accounting data standard packages for fully digital electronic invoices, ordinary and special VAT electronic invoices, railway and air travel vouchers, and other electronic documents. The packages come with supporting guides, element lists and examples. Use the material for the applicable document family and version to configure the extractor. A filename ending in XML does not determine which package or extraction rules apply. A shop order export, for example, could include an amount and invoice number without being the issued electronic invoice. Ministry of Finance electronic voucher accounting data standards
Record how you establish the document type. For structured files, use the document's actual schema and type indicators in combination with the issuer's file and its provenance. Establish any subset of receipt types and versions your integration handles. If the type is uncertain, keep the file and route it for review. Support for a document in an accounting data standard and support for verifying that document in a particular API are separate questions.
A three-field mapping for a digital invoice
The State Taxation Administration describes the invoice number, issue date, buyer, seller and amounts as core elements of a fully digital electronic invoice. Its nationwide numbering scheme assigns 20 digits to this format. The ChinaValidate request example uses the invoice number, a compact issue date and the total including tax for the digital type. The table maps the meaning of each source value to its request key. Choose the actual element names and namespace from the schema you accept. State Taxation Administration announcement on fully digital electronic invoices · Field API request parameters
| Value to locate in the issued file | Field API key | Integration check |
|---|---|---|
| Number assigned to the digital invoice | invoice_number |
Preserve all 20 digits as a string |
| Date printed as the invoice issue date | issue_date |
Use the accepted date format after validating the date |
| Total amount including VAT | total_amount |
Use the issued gross amount as a decimal string in CNY |
| Fully digital invoice type confirmed from the source | invoice_type |
Send digital for the format in this example |
A useful extractor stores the source path within the XML and the raw value as well as the derived request value. The finance team can locate the actual gross amount when nearby totals are similar. Keep the input date and the transformed date separately. The payment date and the day the file arrived in your inbox belong elsewhere. If the total and the component amounts differ, investigate the issued record and its accounting rules rather than substituting a recalculated value for the gross amount shown.
Choose a decimal representation with a period as the separator for the request example. A regional display such as 1,130.00 is a presentation value. Read the XML's original string before it reaches an Excel cell or a floating-point field. Leading zeros, trailing digits and the exact amount can be important during review. Document the selected amount label alongside the submitted string.
Verify the fields from one issued document
Suppose the file shows a 20-digit invoice number, the issue date 2025-03-18, 1,000.00 yuan before tax and 1,130.00 yuan including tax. Below is an illustrative request body for POST /v1/invoices/verify. The gross amount is used even though a net amount is also present in the file.
{
"invoice_type": "digital",
"invoice_number": "25322000000000123456",
"issue_date": "20250318",
"total_amount": "1130.00"
}
Send the request from your own server using the documented bearer authentication and content type. Keep the secret in the server's credential store. Log the protected evidence reference and application outcome with the request, with routine logs limited to what is needed for tracking. The original XML stays linked to the request through the internal invoice or document ID. ChinaValidate field verification API example
The field request sends JSON values derived from the XML. When a team actually receives an issued PDF or OFD, the separate file endpoints document the supported file formats and request structure. A PDF the buyer made from an XML rendering is a display copy. If you keep one for visual comparison, record that relationship and keep the issued attachment available. Help reviewers distinguish what was issued from what your application produced. PDF verification endpoint · OFD verification endpoint
Validation, verification and a posting decision
Use the XML parser to establish that the file is readable and the expected fields can be extracted. Configure parsing to avoid external resource resolution and validate against the known document structure when the accepted schema provides for that. Reject unreadable or ambiguous field data into the review queue. A well-formed XML document and a valid decimal merely allow the workflow to reach verification. They do not establish that the invoice matches an issued record.
Read the API's application code and result items. For a matched outcome, save the returned invoice fields, buyer and seller objects, and the time the result was received. Compare the response and the original extraction against the same invoice record. A mismatch or empty result should point the reviewer to the type, number, date and amount actually submitted. A transport failure merits its own operational status, so the team can see that the verification step did not produce a usable response.
Keep file integrity, extracted data, the verification result and accounting approval as separate fields in the workflow. A verified amount still needs the correct buyer and the appropriate purchase association. The receipt date, ledger period and payment authorization come from your accounting system. This allows a problem in a later step to be corrected without discarding the result already obtained for a particular input.
Versioned extraction rules
Record which extraction configuration handled an invoice. An update to a supported XML schema may change the location or naming of a value while leaving the invoice's visible meaning the same. Keep each configuration tied to its document family and version, and save the field path that was actually read. When an operator reruns a check months later, the application can explain whether the differences came from an updated file or a changed extraction rule.
Avoid matching on a generic local element name taken from anywhere in the document. A validation sample should include totals at several levels and an invoice reference in a related document section. Resolve the identification and amount fields in the correct parts of the invoice. If the expected document structure does not map to a configured version, keep the source available for a human review and record the unsupported structure in the intake system. That gives the person maintaining the extractor a specific case to check against the official materials.
A test set that catches mapping mistakes
Use source fixtures that exercise more than one path. Include a digital invoice where the net and tax-inclusive totals are different. Include one where the file contains a calendar date with separators. Include a long invoice number that a spreadsheet would round if read as numeric data. In each case compare all produced strings with the original field values and the documented request form.
Then test the failure paths with a non-invoice XML file, a missing or ambiguous amount and an input the verification service cannot match. Confirm that the parser failure stays separate from a completed lookup with no match. If a file arrives twice through different channels, the inbox can show two delivery events against the same invoice evidence, with a single verification attempt when the existing result is applicable. When the same file is corrected in a later submission, keep both versions and associate each result with the version used.
One particularly useful acceptance test has an issued XML and a separately received PDF that appear to refer to the same invoice but have different totals. The system should show the two source references, retain the amount found on each, and require confirmation before treating them as interchangeable. The operator should be able to open the correct original without relying on its filename or storage path. That is the point of mapping the values from a document with identity and provenance. It gives the team a verification record they can understand and reproduce.