Hash value error for Simplified Invoice & Simplified Credit Invoice (PHP/Laravel, Simulation)

I’m using PHP (Laravel) to generate e-invoice XMLs in the Simulation/Integration environment.

  • Standard Tax Invoice and Standard Credit Note:
    Both validate successfully in the ZATCA Web Validator and are approved in Compliance checks.

  • Simplified Tax Invoice and Simplified Credit Note:
    The validator returns a hash value error. (No other schema/business rule errors are reported.)

Because the same signing/certificate code path is used for all four document types, I’m trying to understand what is different about the hash requirements for simplified documents.

What I’ve done/checked

  • Same private key and simulation certificate are used for all documents.

  • XML is UTF-8 (no BOM).

  • Timestamps and UUIDs are generated per doc type.

  • The standard docs pass both Validation and Compliance; only the simplified ones fail due to hash value.

  • Re-generated XML after normalizing whitespace/line breaks.

Questions

  1. For simplified documents, is there any difference in how the invoice hash (and, if applicable, previous invoice hash) must be computed compared to standard documents?

  2. Should the PreviousInvoiceHash (if required) point to the immediately preceding issued document, or to the referenced/credited invoice when issuing a simplified credit note?

  3. Are there canonicalization requirements (e.g., Exclusive C14N) or element ordering specifics for simplified docs that differ from standard docs?

  4. Is there a common pitfall (e.g., hashing the wrong node, including/excluding the signature element, or using the QR value instead of the invoice hash) that typically causes this error on simplified invoices?