# 409 status code - Duplicate-Invoice error

**URL:** <https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932>\
**Category:** Clearance and Reporting\
**Created:** [October 30, 2024, 11:11pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932 "2024-10-30T23:11:55Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![Maala](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Maala](https://zatca1.discourse.group/u/Maala)\
**Post date:** [October 31, 2024, 12:49pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/21 "2024-10-31T12:49:44Z")

</div>

@mkw  
exactly, if you don’t need us to send multiple attempts against the same invoice then we need an api to check the invoice status/data/etc

---

<div class="post-metadata">

**Author:** ![rudyzidan](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rudyzidan](https://zatca1.discourse.group/u/rudyzidan)\
**Post date:** [October 31, 2024, 12:54pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/22 "2024-10-31T12:54:52Z")

</div>

Hi Hadi, wanted to confirm the below info/questions.

- I Revisited our logs and found out it was related to the http client timeout up to 3 sec, does that mean it pass the ZATCA business rules / required validations. Can i treat 409 as reported already in my next attempt?

What is the recommended timeout from your perspective and max concurrent retries can be handled by your servers so i can check our end and configure it accordingly.

---

<div class="post-metadata">

**Author:** ![pmohdameen](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@pmohdameen](https://zatca1.discourse.group/u/pmohdameen)\
**Post date:** [October 31, 2024, 12:58pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/23 "2024-10-31T12:58:13Z")

</div>

@Hadi

I think timeout issues are there for a long time now and as you said we all have adjusted our timeouts accordingly considering each scenarios.

In this case, the response is never timedout at ZATCA’s end, but they do respond at the first request with same failed 409. So we will have retry obviously as the request was not a timedout one, but genuine rejection.

Still lets say they are rejecting same payload, then It will contradict what ZATCA Team has said here multiple times:

> [@Credit Note with Same IRN submitted Multiple Times and Cleared](https://zatca1.discourse.group/t/credit-note-with-same-irn-submitted-multiple-times-and-cleared/526/3):
>
> If everything remains same on both XMLs then you can disregard the same XML sent again as ZATCA will consider this as a single transaction.  
> Source: [Credit Note with Same IRN submitted Multiple Times and Cleared - #3 by Ankit\_Tiwari](https://zatca1.discourse.group/t/credit-note-with-same-irn-submitted-multiple-times-and-cleared/526/3)

also,

> [@Ocassionally Reporting API gives einvoice-kafka-publisher ERROR](https://zatca1.discourse.group/t/ocassionally-reporting-api-gives-einvoice-kafka-publisher-error/3177/2):
>
> Our advice is always to re-submit such an invoices till got reported, so stick with your current process please and ignore it.
> 
> Source: [Ocassionally Reporting API gives einvoice-kafka-publisher ERROR - #2 by Aturkistani](https://zatca1.discourse.group/t/ocassionally-reporting-api-gives-einvoice-kafka-publisher-error/3177/2)

In this two cases, they talked about re-reporting same payload without any issue and it was working good till yesterday.

---

<div class="post-metadata">

**Author:** ![rudyzidan](https://avatars.discourse-cdn.com/v4/letter/r/f1d935/32.png) [@rudyzidan](https://zatca1.discourse.group/u/rudyzidan)\
**Post date:** [October 31, 2024, 1:00pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/24 "2024-10-31T13:00:19Z")

</div>

@Aturkistani can you support us ?

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:13pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/25 "2024-10-31T13:13:41Z")

</div>

Actually , Yes it would make senese … what i can sugguest you in current situation (until ZATCA provides checks API) is to have an alternative data store(db) in case if it fails to save in your db . maybe local file .

---

<div class="post-metadata">

**Author:** ![mkw](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@mkw](https://zatca1.discourse.group/u/mkw)\
**Post date:** [October 31, 2024, 1:17pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/26 "2024-10-31T13:17:18Z")

</div>

But we still don’t know if zatca set status of this invoice to reported or not\_reported

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:20pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/27 "2024-10-31T13:20:16Z")

</div>

in my situation , i found this to be good enough :  
1- a retry machinsim . which will submit the same invoice again 3 times (in case if failures) with a delay of 1 second between each retry (mutliplies with each retry) . means first one is 1 second . second one is 2 and third is 3 .  
2- http time out is 10 second

and have been submitting my invoices for more than 1 month now didn’t get any issues

---

<div class="post-metadata">

**Author:** ![pmohdameen](https://avatars.discourse-cdn.com/v4/letter/p/c89c15/32.png) [@pmohdameen](https://zatca1.discourse.group/u/pmohdameen)\
**Post date:** [October 31, 2024, 1:21pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/28 "2024-10-31T13:21:41Z")

</div>

If anyone is waiting for a status checking API from ZATCA’s side, here’s what they have told in past [regarding discrepancies in statistics on fatoora portal]:

> [@We have issue in statistics in zatca portal](https://zatca1.discourse.group/t/we-have-issue-in-statistics-in-zatca-portal/1213/4):
>
> Dear @Ammar each API call gets a response whether it is accepted, rejected or accepted with warnings. You can build your report based on API call responses and rely on it as the single source of truth.

It means that whatever we receive from ZATCA as API response is the **single source of truth** , at least for now. So lets say if we are getting 409 at first response and then again “Invoice Hash Previously Submitted” in subsequent requests, then I dont think we will be able to get a REPORTED status somehow for a valid & already issued/signed XML.

---

<div class="post-metadata">

**Author:** ![Maala](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Maala](https://zatca1.discourse.group/u/Maala)\
**Post date:** [October 31, 2024, 1:25pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/29 "2024-10-31T13:25:31Z")

</div>

@Hadi  
when can we expect the API to be ready? it would be really handful with that breaking change

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:26pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/30 "2024-10-31T13:26:23Z")

</div>

Wait @Maala , I’m not with ZATCA team . i’m an enduser only and developer like you . Just trying to help here with anythin i know 🙂

---

<div class="post-metadata">

**Author:** ![Maala](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Maala](https://zatca1.discourse.group/u/Maala)\
**Post date:** [October 31, 2024, 1:27pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/31 "2024-10-31T13:27:27Z")

</div>

ah lmao - sorry I thought you work for them somehow but yeah anyways we need someone from zatca to support us on this

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:28pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/32 "2024-10-31T13:28:25Z")

</div>

No worries … happy to help with what i know

---

<div class="post-metadata">

**Author:** ![mohdzeeshan5c0](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mohdzeeshan5c0](https://zatca1.discourse.group/u/mohdzeeshan5c0)\
**Post date:** [October 31, 2024, 1:33pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/33 "2024-10-31T13:33:48Z")

</div>

@Maala  
@Hadi  
There could be 3 ways:

1. They give the same response on each sub sequent call of reporting API
2. If they are giving the 409 status as a response in the sub sequent calls then along with it they should also provide the status of this invoice whether it was reported or not\_reported(rejected)
3. Provide an api to check status of the submitted invoice

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:35pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/35 "2024-10-31T13:35:34Z")

</div>

One thing to keep in mind , 409 means reported always .  
in case of rejection . it will not be saved in ZATCA which means it will never give you 409 .

---

<div class="post-metadata">

**Author:** ![mohdzeeshan5c0](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mohdzeeshan5c0](https://zatca1.discourse.group/u/mohdzeeshan5c0)\
**Post date:** [October 31, 2024, 1:41pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/36 "2024-10-31T13:41:41Z")

</div>

@Hadi  
if zatca doesn’t store it then why do we re-generate the xml for the same rejected invoice with different identifiers such as Invoice Hash,ICV,UUID, QR Code and PIH?

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:41pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/37 "2024-10-31T13:41:44Z")

</div>

Here is an example of a connection error happens at my integration but it was able to overcome it and everything is going smoothly .

 ![example](https://europe1.discourse-cdn.com/flex013/uploads/zatca1/original/1X/312815e4f1794a0960c9a80f7afe00471b67adc2.png)

---

<div class="post-metadata">

**Author:** ![Hadi](https://avatars.discourse-cdn.com/v4/letter/h/e99b99/32.png) [@Hadi](https://zatca1.discourse.group/u/Hadi)\
**Post date:** [October 31, 2024, 1:48pm UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/38 "2024-10-31T13:48:19Z")

</div>

Hmmm … yes you are right . it can be eaither cleared or rejected invoice .

Just try to tweek your code to extarct all possible details on each step on the process . this is the only advice i can give you for now .

---

<div class="post-metadata">

**Author:** ![mohdzeeshan5c0](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mohdzeeshan5c0](https://zatca1.discourse.group/u/mohdzeeshan5c0)\
**Post date:** [November 1, 2024, 3:01am UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/39 "2024-11-01T03:01:32Z")

</div>

@idaoud  
Appreciate if someone from zatca could guide us on this.

---

<div class="post-metadata">

**Author:** ![Adithya\_Raviraja](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@Adithya\_Raviraja](https://zatca1.discourse.group/u/Adithya_Raviraja)\
**Post date:** [November 1, 2024, 5:48am UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/40 "2024-11-01T05:48:10Z")

</div>

We also have noticed the same issue in our system as well. And in our case, we received this response in the first attempt of sending the invoice. No amount of retries were able to fix the issue.

If this response is going to be norm from now. Then request to ZATCA team to provide the steps that need to done from to handle the affected documents or like the other users have mentioned, please provide a get API so that we can simple fetch the signed invoice from the ZATCA system and use that.

Finally, this change looks to be very recently implemented to the production systems, requesting the ZATCA team to please provide a public annoucement so that we are prepared with the necessary changes from our end before the actual deployment.

---

<div class="post-metadata">

**Author:** ![Maala](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@Maala](https://zatca1.discourse.group/u/Maala)\
**Post date:** [November 1, 2024, 10:54am UTC](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932/41 "2024-11-01T10:54:38Z")

</div>

@idaoud @Ankit.K.Tiwari  
seeking your urgent help here

[Previous page](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932.md?page=1)

[Next page](https://zatca1.discourse.group/t/409-status-code-duplicate-invoice-error/3932.md?page=3)
