# Test invoices to testing environment to zatca

**URL:** <https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713>\
**Category:** Clearance and Reporting\
**Created:** [April 19, 2025, 8:20pm UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713 "2025-04-19T20:20:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@saeed](https://zatca1.discourse.group/u/saeed)\
**Post date:** [April 19, 2025, 8:20pm UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713/1 "2025-04-19T20:20:07Z")

</div>

i try to test invoice by send it to [https://gw-fatoora.zatca.gov.sa/e-invoicing/developer-portal/compliance/invoices](https://gw-fatoora.zatca.gov.sa/e-invoicing/developer-portal/compliance/invoices) , using BinarySecurityToken and secret key and certificate generated by final csid , in other words i take invoice already sent to zatca and accepted by send to  
[https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/reporting/single](https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/reporting/single) and reported successfully , but when send same invoice to test environment it return unauthorized , how to test invoices , and i have only final certificate and final requestid and secret key .

---

<div class="post-metadata">

**Author:** ![khalifullah](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@khalifullah](https://zatca1.discourse.group/u/khalifullah)\
**Post date:** [April 20, 2025, 5:16am UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713/2 "2025-04-20T05:16:58Z")

</div>

three environment , one environment pcsid (BinarySecurityToken ) not work with another environment see below link  
=\> developer ,  
==\> simulation(test) ,  
===\> production (Core)

> [@E-Invoicing API endpoints](https://zatca1.discourse.group/t/e-invoicing-api-endpoints/487):
>
> A. FATOORA portal (production) ● Onboarding APIs: [https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance](https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance) (Request a pre-compliance CSID) [https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance/invoices](https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance/invoices) (Run compliance checks for reporting and clearance) [https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids](https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids) (Request or renew a production CSID) ● Core Solution APIs: [https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/reporting/single](https://gw-fatoora.zatca.gov.sa/e-invoicing/core/invoices/reporting/single) (Reporting API for Invoices, C…

---

<div class="post-metadata">

**Author:** ![saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@saeed](https://zatca1.discourse.group/u/saeed)\
**Post date:** [April 20, 2025, 9:48am UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713/3 "2025-04-20T09:48:01Z")

</div>

yes i know , so if i generated RequestId, Secret , final certificate for production , and client sync invoices successfully , i have these information only for production , so if i want to test invoice on simulation . can i use same csid and certificate and test , and run [https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/invoices/reporting/single](https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/invoices/reporting/single) . it return unauthorized

---

<div class="post-metadata">

**Author:** ![khalifullah](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@khalifullah](https://zatca1.discourse.group/u/khalifullah)\
**Post date:** [April 23, 2025, 11:53am UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713/4 "2025-04-23T11:53:36Z")

</div>

hi @saeed ` can i use same csid and certificate and test` - **NO**

1. Get your invoice data ready.
2. Change the invoice into the format recommended by ZATCA (UBL format).
3. Secure the invoice by using your environment-specific CSID/certificate on the updated file from Step 2 _(this is just for easier understanding)_.
4. Test the invoice within the ZATCA environment.

Repeat these steps whenever you switch the ZATCA environment, such as between production, simulation, or sandbox

---

<div class="post-metadata">

**Author:** ![saeed](https://avatars.discourse-cdn.com/v4/letter/s/e8c25b/32.png) [@saeed](https://zatca1.discourse.group/u/saeed)\
**Post date:** [April 25, 2025, 10:13pm UTC](https://zatca1.discourse.group/t/test-invoices-to-testing-environment-to-zatca/6713/5 "2025-04-25T22:13:39Z")

</div>

thanks for your support , I got it . and I have 2 questions  
about refund of last invoice that have prepayments invoices ,  
1-should I need to make credit note for all prepayments invoices individually or make credit note only for last invoice , and if no  
2 - Should I set Adjustment of prepayments that used in original invoice in credit note
