Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with B2C Invoice Hash Not Matching Despite Same CSR and Signed Properties #58

Open
hamza-id opened this issue Jan 16, 2025 · 0 comments

Comments

@hamza-id
Copy link

I recently implemented a taxation system in my application, and everything works perfectly in the development environment. As part of the process, I generated a certificate and moved on to test the simulation environment.

When I call the endpoint: https://gw-apic-gov.gazt.gov.sa/e-invoicing/simulation/compliance/invoices
this endpoint will give me that error. Could someone please guide or assist me with that

I encounter the following error:
"errorMessages": [ { "type": "ERROR", "code": "signed-properties-hashing", "category": "CERTIFICATE_ERRORS", "message": "Invalid signed properties hashing, SignedProperties with id='xadesSignedProperties'", "status": "ERROR" } ],

Here’s what I’ve done so far:

  • I generated the required certificate per ZATCA's guidelines.
  • Ensured the compliance XML payload was signed correctly using the generated certificate.
  • Verified that the request headers and payload adhere to the API specifications.

I’ve successfully generated compliant invoices for B2B using my solution. However, I’m facing an issue with B2C invoices.

Here’s what I’ve done now:

Using the same CSR, I’ve signed the invoice through the SDK, and it works perfectly fine.
I’ve verified that my generated signed properties are identical to the ones generated by the SDK.
Despite the above, my hash output is different from the SDK-generated hash.

return base64_encode(hash('sha256', $signed_properties));

Originally posted by @hamza-id in #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant