can't generate Csid

A) after Running the visual studio program.cs file add the OTP and base64 output to get CSID
Code:

using System.Net.Http;
using System.Net.Http.Headers;

HttpClient client = new HttpClient();

HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, “https://gw-fatoora.zatca.gov.sa/e-invoicing/developer-portal/compliance”);

request.Headers.Add(“accept”, “application/json”);
request.Headers.Add(“OTP”, “425204”);
request.Headers.Add(“Accept-Version”, “V2”);

request.Content = new StringContent(“{\n "csr": "TUlJQkpUQ0J6UUlCQURCRk1Rc3dDUVlEVlFRR0V3SlRRVEVQTUEwR0ExVUVDd3dHU21Wa1pHRm9NUlF3RWdZRApWUVFLREF0QmJFcGhZbkpwYzI5bWRERVBNQTBHQTFVRUF3d0dTbVZrWkdGb01GWXdFQVlIS29aSXpqMENBUVlGCks0RUVBQW9EUWdBRTVLSEQvN3FVMEdyL3c1Qmo1Y0FXaFhldWRWc0c2MUlDT2xxYmlPUE5LcTVqZmFDeDJyRmYKeTVyYW5wWndaRll1ZWQyRFg4bjFPQlhKYXhPek1QTUNGNkFwTUNjR0NTcUdTSWIzRFFFSkRqRWFNQmd3Q1FZRApWUjBUQkFJd0FEQUxCZ05WSFE4RUJBTUNCZUF3Q2dZSUtvWkl6ajBFQXdJRFJ3QXdSQUlnU3ZSY1BrWXJXc21NCjI4K0tmcFZiaXBCbHBHcGVGZzNraWNGU1VGYWY1ME1DSUQzZnppajE1QnBkUHdPaitsNVJQM1FwVEpwSlZQWHQKQjNFdHdob1lzd1lC"\n}”);

request.Content.Headers.ContentType = new MediaTypeHeaderValue(“application/json”);

HttpResponseMessage response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();

F) Execution Output :

Unhandled exception. System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (Bad Request).
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at Program.$(String args) in C:\Users\Ishaa\source\repos\CSID\CSID\Program.cs:line 17
at Program.(String args)

C:\Users\Ishaa\source\repos\CSID\CSID\bin\Debug\net8.0\CSID.exe (process 22680) exited with code -532462766 (0xe0434352).
Press any key to close this window . . .

Dear @aljabri

Thanks for reaching out,

Please note that the developer portal is only for clarifying the integration steps,
You can’t integrate successfully using it because it has a dummy data.

The only ways to ensure successfully integration are on Simulation or Production Environments, Our recommendation is to review the Educational library
carefully to ensure following all the steps.

Additionally, for OTP you can take it from fatoora portal for production or fatoora simulation portal for simulation based on the (certificateTemplateName = ASN1:PRINTABLESTRING:PREZATCA-Code-Signing) in your .cnf file, in your case (PREZATCA-Code-Signing) it’s for simulation which means you will get the OTP from fatoora simulation portal.

For any further concerns after reviewing the educational library shared on ZATCA site, please do not hesitate to reach out.

Thanks,
Ibrahem Daoud.