Dear all,
I have generated the CSR and private key from the SDK. How do I sign the invoice? What are the commands and steps I need to follow? The Sandbox documentation isn’t clear.
Dear @Madleen,
Only simplified tax invoices are required to be signed, standard tax invoices signing is not mandatory by the taxpayers, as ZATCA will sign them on their behalf & will override the existing signature if any.
To sign invoices using SDK, please follow the steps below in order:
1- send your generated CSR in the compliance request CSID API, a securityBinaryToken & secret will be returned if the request is called successfully
2- Take the returned SecurityBinaryToken and decode it using base64 decoder, the decoded value is the x.509 certificate
3- go to the SDK folder to the following path: SDK/Data/Certificates/Cert.pem
4- replace the value with your obtained x.509 certificate
5- replace the generated private key with the value in the other file in the same path: SDK/Data/Certificates
6- open the CLI in the path where the invoice that needs to be signed is located and type the below command if you are using JAVA SDK:
fatoora -sign -invoice [invoice file name.XML]
Or if you are using .NET SDK, type the command:
fatooraNet sign -invoice [invoice file name.XML]
By following the above steps, you can sign your simplified tax invoices & submit them in the compliance checks phase (compliance invoice API)
Redo the same steps above but with the returned PCSID from the third API in onboarding process, to sign & submit invoices to the “Reporting” API
Please confirm if this works for you.
Should you require any further clarifications, please don’t hesitate to reach out
Dear @Aturkistani,
Thanks for your help, but I want to make sure I’m following the right steps. After following your instructions, I have a signed invoice. Should I follow the steps outlined in this document (https://zatca1.discourse.group/uploads/short-url/vlHNRGtXbkw5sv40gchVevwarmQ.pdf) before submitting it in the compliance checks phase (Compliance Invoice API)?
@Aturkistani
why using the command not the sdk function EInvoiceSigner.SignDocument?
Dear @Madleen,
If you followed the given steps already, then no need to follow the steps on the document, as Signing function of ZATCA SDK will perform all of the steps automatically
Those steps for taxpayers who are willing to build the signing function from the scratch in alignment with ZATCA’s requriemtns using thier own code/application.
Thank you,
Dear @mdd,
You have the choice to sign your e-invoices with both ways, no restrections by ZATCA.
To use EInvoiceSigner function, make sure that you reference the .Net SDK DLL in your project correctly with all of the contracts & assembly set-up correctly.
You can refer to the .Net SDK readme file inside our SDK folder for more information, thank you.