Firstly , it seems that there are two different scenarios for handling rejected invoices. On one hand, it says that I have to issue a Credit Note for a rejected invoice and a new invoice will be issued (with different IRN and identifiers as I understood).
But on the other hand, it suggests fixing the problem then resubmitting the invoice with new identifiers (Preserving IRN and issue date of rejected simplified invoice). This left me unsure about the correct process to follow. are these two different scenarios? does “not_reported” indicated a different status Code than “rejected” ?
Secondly, for difference between rejecting a Standard invoice and a simplified invoice. after fix errors,
Standard Invoice → should I resubmitted with new Date and Time retaining the original IRN of the rejected invoice?
Simplified invoices → should I retain the date, time and the IRN of original invoice?
In both cases, I must change the identifiers UUID,ICV and PIH.
Kindly note the following response types from the API, encompassing all scenarios post-successful onboarding:
200 OK: Indicates that the invoice was accepted without any warnings or errors.
202 Accepted: Signifies acceptance of the invoice from ZATCA with a warning. You can refer to the validation result in the response to identify the reason for the warning and prevent it in future invoices.
3.400 Bad Request: Indicates rejection of the invoice. You can review the validation result in the API response to pinpoint the exact issue and rectify it.
For rejected invoices (indicating an error rather than a warning, which is not acceptable for ZATCA), follow these steps to address the issue and resubmit the invoice for acceptance:
Clearance (standard) invoices:
Correct the error as indicated in the API response within your XML file based on the error message.
Please ensure to update the PIH (Previous Invoice Hash) for the new invoice. For instance, if you submitted invoices 1, 2, and 3 sequentially and invoice 2 was rejected for an error, you need to submit a new invoice (invoice 4) after fixing the error. Ensure that the PIH for invoice 4 is the HASH for the last submitted invoice, in this case, invoice 3.
After rectifying the error, update the HASH, UUID, and ICV before submitting it to the Clearance API. The API response should reflect clearance (accepted by ZATCA), with the encoded XML containing the updated timestamp.
Reporting (Simplified) Invoices:
Rectify the error highlighted in the response within your XML file based on the error message.
Please remember the PIH for the new invoice. as per the scenario we mentioned previously.
After correcting the XML error, update the HASH, UUID, and ICV before submitting it to the reporting API. The response should indicate successful reporting, signifying that your invoice is error-free and accepted.