China Invoice Verification API Errors
Handle ChinaValidate invoice verification outcomes, invalid requests, timeouts and repeat charges without confusing API failures with invoice findings.
Verify a Chinese invoice using its printed details.

An accounts-payable worker may see a failed verification job and an invoice mismatch in the same queue. The failed job might have an expired credential or a request that never reached completion. The mismatch is a completed check and calls for someone to review the invoice or its inputs. If a worker treats both as retryable, it can send the same invoice again, incur another charge and leave the reviewer without a clear answer.
ChinaValidate's invoice verification API exposes two separate things to the application. The response code and message describe the request. The verification_status field inside a result item describes the invoice outcome. Record both. For a client-side connection failure, keep a separate record of the attempt and whether the application actually received an API response.
Three outcomes in a morning queue
In a fictional accounts-payable queue, the first invoice is a Chinese digital VAT invoice. A clerk enters the amount excluding tax where the digital endpoint expects the total including tax. When an invoice check completes with a mismatch, review the original fields before deciding to resubmit it. If the request is rejected before a check completes, correct the invalid input. The response determines which of these happened. Do not make the worker use one retry action for both.
The second request arrives after the team changes the API key. The server reports that the key is invalid. Restoring the right credential is an integration task. Returning to the supplier for a different invoice would not address it. The third request finishes with a match, but the amount on the purchase order is different because part of the order has already been invoiced. That is an accounting review. A matched invoice check does not establish that the full order amount is due.
Give the queue different actions for these cases: correct or re-enter inputs, restore the connection or credential, and review a completed invoice. Staff should be able to see why the item is in the queue without reading a raw JSON object or interpreting a generic “verification failed” badge.
The response and the invoice finding
For a field request, the current documented match example uses response code 200 and an array at data.items. The first item in that example has verification_status equal to matched. Inspect the item and preserve the original values from data. Localized display fields are convenient for reviewers, and the original names and identifiers are the evidence used to reconcile the document. The excerpt below omits other fields and is illustrative. Invoice verification API documentation
{
"code": 200,
"msg": "ok",
"data": {
"total_count": 1,
"items": [
{
"verification_status": "matched",
"invoice_type": "digital",
"invoice_number": "25322000000000123456",
"issue_date": "2025-03-18",
"total_amount": "1130.00"
}
]
}
}
A matched result can go to the next accounting checks. Compare the invoice seller and buyer with the transaction, the amount with the order and receipt, and the identifier with the internal payable register. A mismatch calls for comparison of the submitted fields and the actual invoice. A not_found result calls for checking input, invoice type and the relevant lookup conditions before escalating or asking the supplier for records. The Chinese tax authority also explains the meanings and limits of results on its public invoice platform. Use that guidance for the platform's coverage and procedure. Use the API documentation for the structure and values a ChinaValidate integration receives. State Taxation Administration invoice lookup results
The API documentation names those statuses as examples. If the integration receives a successful envelope without a usable verification item, record the exact response and route it to a reviewer. Do the same for statuses you do not recognize. Do not replace either case with a match or a mismatch. Preserve the item identity when you associate a result with a job so it remains clear which invoice was checked.
Keep the buyer and seller tax identifiers as strings when returned and compare them with the right legal entities in the supplier and purchase records. Translation can improve readability for finance colleagues abroad. It does not change whether the billed entity and the contracting entity are the same. If a supplier presents a red-letter invoice correcting a prior document, preserve that relationship and let the responsible accountant determine the treatment for each invoice. The fact that an individual document can be checked does not show how a correction should be posted. State Taxation Administration guidance on red-letter digital invoices
A routing table for the integration
| Observation | Action for the application |
|---|---|
A completed item has matched |
Store the evidence and continue the accounting checks. |
A completed item has mismatch or not_found |
Send to invoice review. Resubmit only with a reason, such as corrected input. |
Code 400 |
Follow msg. Correct invalid inputs before sending again. Treat an explicitly reported translation timeout according to its documented retry message. |
Code 401 or 403 |
Resolve key or access problems. Keep the invoice outcome undecided for this attempt. |
Code 402 |
Resolve the API balance issue before resuming affected work. |
Code 429 |
Slow the account's request rate and defer eligible jobs. |
| The connection ends before a usable response | Record that completion is unknown to the caller. Check the attempt before issuing a repeat request. |
An HTTP-level timeout or broken connection is different from receiving the service's documented translation-timeout response. The second case explicitly says no API credit was charged and asks the caller to retry. In the first case, the sender has lost the answer. The request may have completed after the client stopped waiting. Keep that distinction when designing job retries, especially if the scheduled job can run on more than one worker. The general HTTP guidance warns against automatic replay of methods that are not known to be idempotent when the caller cannot determine whether the original action ran. HTTP Semantics, idempotent methods
For a rate-limited account, avoid letting each worker immediately resubmit the same work. Space out requests and maintain a cap on retry attempts. HTTP defines 429 for too many requests and permits a Retry-After header. Where such guidance is provided, take it into account. The absence of that header does not make a retry immediately appropriate. Keep a single view of which invoice jobs are awaiting another attempt. HTTP 429 specification
Correcting a field request
The documented field endpoint is POST /v1/invoices/verify. A digital VAT invoice uses invoice_type set to digital and a tax-inclusive total_amount. A coded special VAT invoice uses vat_special and the applicable net_amount. A coded ordinary VAT invoice uses vat_ordinary and the required last six digits of the printed verification code. Preserve numbers and codes as strings, including leading zeros. The issue date in the request uses YYYYMMDD. Store the original invoice and record the submitted fields separately, so a person can diagnose the difference directly.
This example uses documented digital-invoice fields and fictional data. It prints no real key in the example. Use an environment variable from the server's key storage and replace the illustrative invoice fields in an authorized test. The command sends the invoice once.
curl -sS 'https://api.chinavalidate.com/v1/invoices/verify' \
--header "Authorization: Bearer ${CHINAVALIDATE_API_KEY}" \
--header 'Content-Type: application/json' \
--data '{
"invoice_type": "digital",
"invoice_number": "25322000000000123456",
"issue_date": "20250318",
"total_amount": "1130.00"
}'
For PDF or OFD requests, inspect whether the correct endpoint received the original document. The file endpoints accept JSON with file_base64, containing the Base64 of the original bytes without a data-URL prefix. A filename extension does not convert a scanned copy or exported file into a usable original. If the upload is invalid, recover the proper input before calling again. Preserve access to the original for staff who are authorized to investigate, and keep full document bytes out of job messages and diagnostic logs. PDF endpoint documentation · OFD endpoint documentation
Repeat requests and credits
The documented billing rule charges for completed requests, including normal no-result responses and invoice mismatches. Input errors and service failures are free. A completed repeat request is charged separately. A no-result response and a response with no text to translate use the Chinese rate. This makes it useful to distinguish a verified invoice that someone wants to check again from a job that failed before completion. The application should make the reason visible before the user chooses a retry.
One approach is to associate the original input and intended verification method with an internal job, and give individual attempts their own timestamps and states. Avoid submitting a second copy of the same job while an attempt is still running. If no response was received, preserve uncertainty and use the API workspace or account records available to your team when reconciling the attempt. Set a bounded retry policy. An internal job identifier helps your application coordinate its workers. It is not evidence that the verification endpoint will treat duplicate calls as one request.
A bilingual review queue may only need an English display for certain records. Choose the response language for the user of the result and keep the original fields available. If a fully translated result is required and the service reports a translation timeout, handle that as the documented response and preserve the retry reason. Avoid silently substituting a different language and presenting that change as if the requested output had arrived.
A handoff that closes the queue item
Save the endpoint, outcome, input reference, time and action taken. Keep authorization credentials out of the record. An analyst handling a mismatch should see the compared invoice details and whether a corrected request was sent. A developer handling authentication, balance or rate handling should see the relevant error and queued work. Where an attempt remains unknown, say that the result did not reach the application and keep the potential repeat charge in the decision.
In the morning example, the first invoice needs corrected input or examination of its completed mismatch. The second needs an API credential fix, and the third already has an invoice finding but requires order reconciliation. Each can move once its own issue is resolved. A verification queue that preserves these different outcomes gives both finance and engineering a clear record of what happened.