Assistance Needed with PCSID Issue "The provided CurrentCCSID is invalid"

Hi Zatca Team,

I hope this message finds you well.

We have successfully onboarded a lot of clients.

However, we are encountering an issue with some of them while obtaining the PCSID.

The response from the Zatca endpoint (https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids) is as follows:

{

“status_code”: 400,
“version”: “HTTP/1.1”,
“message”: “Bad Request”,
“body”: {
“code”: “Invalid-CurrentCCSID”,
“message”: “The provided CurrentCCSID is invalid”
}
}

All preceding steps, including generating and sending the CSR and conducting compliance checks on six types of invoices (1100), have been executed correctly, except for the final step of obtaining the PCSID.

For detailed request and response data, please refer to this link: Request & Response Data.

Thank you for your assistance.

Best regards,

1 Like

Dear @SlaDev

Thanks for reaching out,

Can I kindly ask you to confirm if you are sending in the request both (binaryToken, and secret) from the compliance API in the (https://gw-fatoora.zatca.gov.sa/e-invoicing/core/production/csids) as basic auth in the authorization?

Thanks,
Ibrahem Daoud.

1 Like

Dear @idaoud

No In the production/csids
I sent the compilance_requests_id only

request body

{
  "method": "POST",
  "headers": {
    "Content-Length": [
      "41"
    ],
    "User-Agent": [
      "GuzzleHttp/7"
    ],
    "Host": [
      "gw-fatoora.zatca.gov.sa"
    ],
    "accept": [
      "application/json"
    ],
    "Content-Type": [
      "application/json"
    ],
    "Accept-Version": [
      "V2"
    ],
    "Authorization": [
      "Basic token"
    ]
  },
  "uri": "/e-invoicing/core/production/csids",
  "version": "HTTP/1.1",
  "body": {
    "compliance_request_id": "1727863119677"
  }
}


The response

{
  "headers": {
    "Connection": [
      "Keep-Alive"
    ],
    "Date": [
      "Wed, 02 Oct 2024 09:58:48 GMT"
    ],
    "Content-Type": [
      "application/json"
    ],
    "Vary": [
      "Origin,Access-Control-Request-Method,Access-Control-Request-Headers"
    ],
    "X-Content-Type-Options": [
      "nosniff"
    ],
    "X-XSS-Protection": [
      "1; mode=block"
    ],
    "Cache-Control": [
      "no-store, max-age=0"
    ],
    "Pragma": [
      "no-cache"
    ],
    "Expires": [
      "0"
    ],
    "Strict-Transport-Security": [
      "max-age=15724800; includeSubDomains"
    ],
    "X-Frame-Options": [
      "DENY"
    ],
    "Content-Security-Policy": [
      "default-src 'none'; script-src 'self'; connect-src 'self'; img-src 'self'; style-src 'self'; frame-ancestors 'none'; form-action 'self'"
    ],
    "X-Global-Transaction-ID": [
      "5a9caee766fd1958540d4b5f"
    ],
    "Set-Cookie": [
      "TS0106293e=0132a679c06925656d6ac8090c7121640b2fda8a1891f1e5fe80644e48bcd4caf67321048796aa84c23501fa7688bd039ad036ed9f; Path=/; Domain=.gw-fatoora.zatca.gov.sa"
    ],
    "Transfer-Encoding": [
      "chunked"
    ]
  },
  "status_code": 400,
  "version": "HTTP/1.1",
  "message": "Bad Request",
  "body": {
    "code": "Invalid-CurrentCCSID",
    "message": "The provided CurrentCCSID is invalid"
  }
}


Dear @SlaDev

Thanks for reaching out,

Please note that you need to send the CCSID as basic auth in the Authentication (binaryToken as userName, and secret as password).

Thanks,
Ibrahem Daoud.

@idaoud I’m encountering the same issue in the simulation environment. In addition to including ‘compliance_request_id’ in the body, I’m also adding the base64-encoded ‘binaryToken:secret’ in the Authorization header.

While we’ve successfully onboarded many businesses in both the production and simulation environments, this issue has only started occurring in the simulation environment over the past two weeks.

1 Like

@idaoud I’m encountering the same issue in the simulation environment. In addition to including ‘compliance_request_id’ in the body, I’m also adding the base64-encoded ‘binaryToken:secret’ in the Authorization header.

While we’ve successfully onboarded many businesses in both the production and simulation environments, this issue has only started occurring in the simulation environment over the past two weeks.

Can you please recheck csr.invoice.type in the config file?

If you choose 1100, it means you have to send 3 Standard Invoices (tax invoice, Credit Note and Debit Note) and 3 Simplified invoices (tax invoice, Credit Note and Debit Note) to Compliance Check. and make sure you use the correct API end point

Hi @lalomar ,

Yes, the csr.invoice.type is 1100, and I’m sending six documents for compliance verification:

  1. Simple invoice
  2. Simple credit note
  3. Simple debit note
  4. Standard invoice
  5. Standard credit note
  6. Standard debit note

The compliance check was successful.

Here are the URLs and their results:

CSID Retrieval:

URL: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance – Process was successful.

Compliance Check:

URL: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/compliance/invoices – Process was successful.

Production CSID Retrieval:

URL: https://gw-fatoora.zatca.gov.sa/e-invoicing/simulation/production/csids – This request failed with the mentioned error.

I’ve included the Authorization header (base64 encoded binaryToken:secret) and OTP header, along with the compliance_request_id in the request body.

We’ve been following the steps outlined in the Integration Sandbox.

Over the past two years, we’ve successfully integrated with ZATCA and onboarded multiple businesses, but we’ve only encountered this issue in the past two weeks.

Let me know if you need any further information.

Dear @hemanthsr ,

This issue is probably related to one of the following:

1- the provided CCSID in the authorization header (binary security token & secret) is not related to the request_id in the body of the PCSID API request. So kindly ensure to submit the right request_id with the related CCSID in the authorization header.

2- the CSR was not generated for simulation, if using the CLI SDK, you should include the flag -sim in the command of the CSR generation.

3- There is a mistake with the format of the CSR config file, you can refer to the example provided in the SDK, you can find it \Data\Input directory, also you can refer to the detailed technical guideline for more information related to the CSR input.

Finally, If you are using OpenSSL, please ensure that the certificateTemplateName in the config file is ASN1:PRINTABLESTRING:PREZATCA-Code-Signing

Thank you,

1 - The CCSID in the authorization header is related to request_id
2 - The CSR was generated successfully.
3 - We don’t think there is any issue here.

We’ve onboarded around 5 businesses since i posted this question. All of then were onboarded successfully. Except this one business which we are not able to onboard.

We suspect the issue could be just with this specific business.

1 Like

Morning @hemanthsr

Thanks for reaching out,

To ensure comprehensive support as usual, can I kindly ask you to mention the steps you followed from the first step to generate the CSR, until getting the error you mentioned?

Thanks,
Ibrahem Daoud.

  1. Added the Proper CSR Config file
  2. Generated the CSR using that -sim sub-cmd, (Successful)
  3. Generated Compliance CSID using a valid Simulation Portal OTP (Successful)
  4. Checked the compliance for all the 6 type (All are reported/Cleared (Successfully))
  5. then generating while Production CSID for simulation server getting this error
    {

“status_code”: 400,
“version”: “HTTP/1.1”,
“message”: “Bad Request”,
“body”: {
“code”: “Invalid-CurrentCCSID”,
“message”: “The provided CurrentCCSID is invalid”
}
}

Hi @hemanthsr I am facing the same issue with our client. can you please tell me how did you solve this issue? or @idaoud if you found the solution?

Dear @techstation

Thanks for reaching out, Welcome to our community.

Can you confirm if you are still receiving this error?

Thanks,
Ibrahem Daoud.

Thanks for being so patient
I am facing the same problem on the production env using sdk

  • Successfully generated the csr with fatoora -csr -csrconfig csr-config.properties
  • Successfully generated CCSID using valid OTP https://gw-fatoora.zatca.gov.sa/e-invoicing/core/compliance
  • Sent the 6 documents with the returned CCSID with Authorization header binarySecurityToken:secret and all returned (202 accepted)
  • Tried to get the final CCSID with the same credentials using the correct compliance_request_id in request body but always fail

Is there any thing that i am missing because i completed the same using simulation env successfully days ago

Thanks in advance

Dear @hosamelbasiony

Thanks for reaching out,

Please note that providing some screenshot with the exact cleared steps will be helpful for our investigation to provide comprehensive support as usual.

Thanks,
Ibrahem Daoud.