PIH & ICV Generation Time

Will there be any issue if the invoice issue date and time are generated at the time of XML creation?

@mohan_manakkal if the Invoice Issue Date and Invoice Issue Time on XML is same as per the actual generation of invoice from source system then no issue. Your source system is the single source of truth not the middleware.

Ok on final approval these dates and icv ,xml ,hash are generated and submitted to the api. Issue date and time will keep with the invoice details in our db.
And one more clarification is needed if b2b is failed the icv,hash and uuid is regenerated. What about issue date and time?

@mohan_manakkal for B2B invoices, you can either keep the Invoice Issue Date and Time as original one or update it to current date - both options are valid as B2B invoice is valid only after Clearance by ZATCA.

However, for B2C invoices the Invoice Issue Date and time must be as per original transaction.

1 Like

@Ankit.K.Tiwari thanks

Scenario Regarding Invoice Drafting and ICV Sequencing

Based on previous discussions, I would like to confirm whether the following scenario is considered valid:

Let’s assume the system generates an invoice in two phases:

Phase 1: Draft Creation

In this step, the system creates the invoice as a draft. At this point, the invoice date/time and invoice number (IRN) are generated.

Phase 2: Finalization and Submission

In this phase, the system generates the required identifiers, the XML file, and submits the invoice to ZATCA for clearance.


Now, consider the following case:

  • Invoice 003 is created as a draft on 2025-06-24 08:00:00, but is not yet cleared.
  • Invoice 004 is created after Invoice 003 and is cleared before it. Let’s assume the ICV assigned to Invoice 004 is 3.
  • Later, Invoice 003 is finalized and submitted to ZATCA, and it receives an ICV of 4.

This results in the following data in the system:

IRN ICV Timestamp
003 4 2025-06-24 08:00:00
004 3 2025-06-24 XX:XX:XX

As shown above, Invoice 003 has a higher ICV than Invoice 004, even though its timestamp is earlier.


Question:
Is this scenario acceptable under the e-invoicing regulations and ZATCA’s expectations regarding ICV sequencing and invoice timelines?

Hello @Ankit.K.Tiwari , follow-up on this please. Thank you !

@mnuaimi please note that there is no limitation on sending invoices to ZATCA out of order, that means you can send invoice with ICV 4 before sending invoice with ICV 3/2/1. So long as invoices are generated in the sequence, it doesn’t matter if they are sent to ZATCA out of sequence.

Given this understanding, in your example, invoice with IRN 004 should have been assigned ICV 4 and it wouldn’t cause any concern even if it was sent earlier to the invoice with IRN 003 with ICV 3. Ideally, IRN, Invoice Issue Date, ICV, PIH and UUID should be assigned only at second step where invoice becomes final not at the draft stage as drafts may be subject to amendments or rejection by competent approvers.

2 Likes

Dear Ankit,

Thank you for your continued support.
final confirmation, is the senario given by @mnuaimi not compliant with Zatca regulations?
because we set IRN in the begging, then generate ICV at the time of approval. after that we sent to Zatca irrespective to ICV order.

another example, after approving Inv3 and Inv 4:
last generated xml with ICV 2
inv 3 approved -> try to generate xml -> failed to get last ICV due to any error -> xml generation failed.
inv 4 approved -> try to generate xml -> get ICV 3 -> generated and cleared successfully.
inv 3 retry generate xml -> get ICV 4 -> generated and cleared successfully.

will this remain acceptable for Zatca?

Regards,

1 Like

So in this case how to take the pih?

@DS2022 For Invoice 3, when you say “XML generation failed” does it mean it was rejected by ZATCA with a 400 response? If yes, then the ICV consumed by a rejected invoice must not be assigned again.

@mohan_manakkal PIH follows the same sequential logic as ICV.

1 Like

@Ankit.K.Tiwari , No, I don’t mean invoice rejection. I mean by “XML generation failed” that although invoice has been has been successfully saved to DB, it failed to generate associated XML file(before sending to ZATCA) Due to any error. e.g. XML generation service failed to create xml because of a connection timeout/ a missing configuration.
So in this case B2C invoice must be committed to continue Cashier progress. so it will not prevent INV 4 xml from generation process. So, INV 4 may have an ICV prior to INV 3.
and INV 3 can be fixed later and get the last generated ICV+1.

@DS2022 if it is not due to rejection by ZATCA, then ZATCA cannot comment on taxpayers’ internal processes. IRN and ICV must be sequential, if there are mismatches or gaps, ZATCA teams would most likely ask for reasons and you can provide the clarifications including detailed reasons for failure to generate XML.