0

I am encountering error 394 when trying to submit the NFC-e to SEFAZ. The error message indicates that the invoice is being rejected due to "missing QR-Code information." However, when generating the XML using xmlbuilder2 in Node.js, the tag is already present and correctly formed within the tag.

Can anyone help me understand why SEFAZ is rejecting the XML and what adjustments I can make to the QR-Code generation or the XML to ensure it gets accepted?

Here’s the relevant part of the generated XML:

<infNFeSupl>
  <qrCode>http://www.sefaz.pi.gov.br/nfce/qrcode?p=22250633778817000144650010000000531857920780|2|1|1|524505B3CCBDA1B7AC94C9CC45A3E025E149C9A7</qrCode>
  <urlChave>www.sefaz.pi.gov.br/nfce/consulta</urlChave>
</infNFeSupl>

Additionally, the code to generate the QR-Code is structured as follows:

const qrCode = 'http://www.sefaz.pi.gov.br/nfce/qrcode?p=' + chaveNFe + '|2|1|1|' + hashQRCode;

Has anyone experienced this error or has suggestions on how to fix the QR-Code generation so the XML can be accepted by SEFAZ?

Code:

    const baseUrl = sefazInfo.qrCode;
    const versaoQrCode = "2";
    const idCSC = empresa.cscId;
    const cscToken = empresa.cscToken;

    const qrCodeString = `${chave}|${versaoQrCode}|${tpAmb}|${idCSC}`;

    const cHashQRCode = crypto
      .createHmac("sha1", cscToken)
      .update(qrCodeString)
      .digest("hex")
      .toUpperCase();

    const qrCodeFinal = `${baseUrl}?p=${qrCodeString}|${cHashQRCode}`;

    const urlChave = baseUrl
      .replace(/^https?:\/\//, "")
      .replace(/\?.*$/, "")
      .replace("/qrcode", "/consulta");
1
  • The qrCode URL gives me 403 Forbidden. Am I not supposed to call it? Commented Jun 17 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.