# Simulation "Invalid OTP"

**URL:** <https://zatca1.discourse.group/t/simulation-invalid-otp/6974>\
**Category:** FATOORA portal and Simulation portal\
**Created:** [May 10, 2025, 8:38pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974 "2025-05-10T20:38:33Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![ucitco](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@ucitco](https://zatca1.discourse.group/u/ucitco)\
**Post date:** [May 10, 2025, 8:38pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/1 "2025-05-10T20:38:33Z")

</div>

Hello,

I successfully comply with development (with 123345 OTP) and I’m getting successful transaction for invoices/debit Notes/Credit Notes. I tested the full cycle and everything is working correctly.

When I tried the simulation I’m getting {“errors”:[{“code”:“Invalid-OTP”,“message”:“The provided OTP is invalid”}]}  
I added the flag -sim while using the SDK.  
and I’m using [https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation](https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation) base URL.

I double checked the TRN number/Commercial Registration Number etc.. and everything is correct.

Could you please help with this?

Regards

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [May 11, 2025, 4:17am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/2 "2025-05-11T04:17:19Z")

</div>

Morning @ucitco

Thanks for reaching out, Welcome to our community.

To provide comprehensive support as usual, can I kindly ask you to mention the steps you followed to generate your CSR along with the steps you followed after login to fatoora portal?

Thanks,  
Ibrahem Daoud.

---

<div class="post-metadata">

**Author:** ![ucitco](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@ucitco](https://zatca1.discourse.group/u/ucitco)\
**Post date:** [May 11, 2025, 12:04pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/3 "2025-05-11T12:04:21Z")

</div>

1 - I created the config file like this:  
“csr.common.name=\_\_commonName\n” .  
“csr.serial.number=\_\_serialNumber\n” .  
“csr.organization.identifier=\_\_vatNumber\n” .  
“csr.organization.unit.name=\_\_organizationalUnitName\n” .  
“csr.organization.name=\_\_organizationName\n” .  
“csr.country.name=\_\_country\n” .  
“csr.invoice.type=\_\_invoiceType\n” .  
“csr.location.address=\_\_registeredAddress\n” .  
“csr.industry.business.category=\_\_businessCategory”;

2- I created the keys by:  
-sim -csr -csrConfig {csrPath} -privateKey {privateKeyPath} -generatedCsr {generatedCsrPath}

3- My customer login to zatca portal, switch to simulation portal, request token for 1 device, share generated otp and apply it to our system.

4- I sent the OTP to the link like:  
return Http::withHeaders([  
“accept” =\> “application/json”,  
“OTP” =\> $otp,  
“Accept-Version” =\> “V2”,  
“Content-Type” =\> “application/json”  
])-\>post(“[https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance](https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance)”, [  
“csr” =\> $encodedCsr  
])-\>json();

As I mentioned earlier, in development. Every things working fine.

Please note as well, that our solution we used is (online) server and its hosted in Europe.

Regards

---

<div class="post-metadata">

**Author:** ![Aturkistani](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Aturkistani](https://zatca1.discourse.group/u/Aturkistani)\
**Post date:** [May 12, 2025, 12:02pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/4 "2025-05-12T12:02:58Z")

</div>

Dear @ucitco,

Please ensure the following:

1- Is this a VAT group scenario? If the customer is belonged to a VAT group, make sure to include the TIN number in the csr.orgnization.unit.name

2- Ensure that the OTP is being generated from simulation portal not the fatoora productio

3- Ensure that the endpoint is adjusted to simulation

4- ensure that the VAT number that you are including in csr.orgnization.identifier is identical to the VAT number that appears in the fatoora portal

5- OTP should be used within 1 hour, if this time frame exceeds, then a new OTP is needed.

---

<div class="post-metadata">

**Author:** ![ucitco](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@ucitco](https://zatca1.discourse.group/u/ucitco)\
**Post date:** [May 13, 2025, 1:52pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/5 "2025-05-13T13:52:17Z")

</div>

We double check above all those points you mention.

whats strange is OTP with development working fine, while its not working in simualtion.

do you have any reference on how we can solve issue or if we can make meeting?

---

<div class="post-metadata">

**Author:** ![taron](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@taron](https://zatca1.discourse.group/u/taron)\
**Post date:** [May 31, 2025, 9:05am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/6 "2025-05-31T09:05:56Z")

</div>

Hello. I have same issue. Did you find a solution?

---

<div class="post-metadata">

**Author:** ![nadirmu](https://avatars.discourse-cdn.com/v4/letter/n/dc4da7/32.png) [@nadirmu](https://zatca1.discourse.group/u/nadirmu)\
**Post date:** [June 1, 2025, 9:30am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/7 "2025-06-01T09:30:42Z")

</div>

Also I have some issues

---

<div class="post-metadata">

**Author:** ![ucitco](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@ucitco](https://zatca1.discourse.group/u/ucitco)\
**Post date:** [July 8, 2025, 8:52am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/8 "2025-07-08T08:52:05Z")

</div>

hello, did u solve the issue?

---

<div class="post-metadata">

**Author:** ![ucitco](https://avatars.discourse-cdn.com/v4/letter/u/4bbf92/32.png) [@ucitco](https://zatca1.discourse.group/u/ucitco)\
**Post date:** [July 8, 2025, 8:53am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/9 "2025-07-08T08:53:16Z")

</div>

hello did u solve the issue, We still stuck on the same error, what i hear that software used to generate private key, ect must be located in KSA

---

<div class="post-metadata">

**Author:** ![Aturkistani](https://avatars.discourse-cdn.com/v4/letter/a/8baadc/32.png) [@Aturkistani](https://zatca1.discourse.group/u/Aturkistani)\
**Post date:** [July 9, 2025, 6:51am UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/10 "2025-07-09T06:51:19Z")

</div>

Dear @ucitco,

There are no restrections on the device/server to be physically located in KSA, however, if you are still facing this issue kindly raise a ticket through ZATCA’s line or your releationship manager with ZATCA.

“invalid-OTP” is a common error, if you followed all of the provided steps previously and the issue still persists, please raise a ticket for further support.

Regards,

---

<div class="post-metadata">

**Author:** ![taron](https://avatars.discourse-cdn.com/v4/letter/t/e36b37/32.png) [@taron](https://zatca1.discourse.group/u/taron)\
**Post date:** [July 23, 2025, 4:28pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/11 "2025-07-23T16:28:20Z")

</div>

@ucitco I did, but I forgot what was the reason.I wrote a simple php library and it works fine. It’s open-source, so you can use it if you still have that issue [GitHub - sevaske/zatca-api: Zatca API Client](https://github.com/sevaske/zatca-api)

---

<div class="post-metadata">

**Author:** ![clovis.gustave](https://avatars.discourse-cdn.com/v4/letter/c/f14d63/32.png) [@clovis.gustave](https://zatca1.discourse.group/u/clovis.gustave)\
**Post date:** [October 21, 2025, 1:57pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/12 "2025-10-21T13:57:39Z")

</div>

I’ve the same exact issue. I tried many things but unfortunately I failed!

I did these steps:

1. Filled CSR properties (used the demo from the SDK)

```ini
csr.common.name=TST-886431145-399999999900003
csr.serial.number=1-TST|2-TST|3-ed22f1d8-e6a2-1118-9b58-d9a8f11e445f
csr.organization.identifier=399999999900003
csr.organization.unit.name=Riyadh Branch
csr.organization.name=Maximum Speed Tech Supply LTD
csr.country.name=SA
csr.invoice.type=1100
csr.location.address=RRRD2929
csr.industry.business.category=Supply activities

```

1. Successfully generated `outputCsrFile.csr` and `privateKeyFile.key` using `[-csr, -csrConfig, csr-config-example-EN.properties, -sim]` arguments.

2. Tried to **POST** CCSID as following:

- **URL** : [https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance](https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance)
- **HEADERS:**

```cfg
Accept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ZWo4ClFZT08raTN5OGlRNEtYdDgrdz09Ci0tLS0tRU5EIENFUlRJRklDQVRFIFJFUVVFU1QtLS0tLQo="
}

```

1. Got this response!

```json
{
  "errors": [
    {
      "code": "Invalid-OTP",
      "message": "The provided OTP is invalid"
    }
  ]
}

```

This suppose to be a simulation part. I wonder why the API didn’t accept `123345` **OTP** value!

NOTE: I use **zatca-einvoicing-sdk-Java-238-R3.4.5**

---

<div class="post-metadata">

**Author:** ![idaoud](https://avatars.discourse-cdn.com/v4/letter/i/f9ae1b/32.png) [@idaoud](https://zatca1.discourse.group/u/idaoud)\
**Post date:** [October 21, 2025, 2:27pm UTC](https://zatca1.discourse.group/t/simulation-invalid-otp/6974/13 "2025-10-21T14:27:42Z")

</div>

Dear @clovis.gustave

Thanks for reaching out. Welcome to our community.

Kindly note that the OTP should be generated from fatoora portal **if you are trying to onboard in Production environment,** and from fatoora simulation portal **if you are trying to onboard in Simulation environment.**

Thanks,  
Ibrahem Daoud.
