FAQ & troubleshooting¶
Does a valid result mean the NIF/IBAN actually exists?¶
No. pt-fiscal checks structure and check digits only. A NIF can be structurally valid but never assigned; an IBAN can be valid but closed. Confirming existence requires the AT or the bank.
validateNif returns false for a number I believe is valid¶
Check three things: it has exactly 9 digits, the leading digit/range is a recognized
taxpayer type, and the mod-11 check digit is correct. entityType() returns
'desconhecido' for an unrecognized leading digit — that also makes validateNif return
false.
Can I use it in the browser / edge runtimes?¶
Yes. It's pure ESM with no runtime dependencies and no Node-specific APIs, so it runs in browsers, workers and edge functions as well as Node.
How do I actually render the invoice QR code?¶
buildInvoiceQRCode() returns the AT field string; render it to an image with any QR
library (e.g. qrcode). See Invoicing. pt-fiscal deliberately doesn't bundle
a QR renderer to stay dependency-free.
The Q (hash) field — where does it come from?¶
From your certified invoicing software's digital signature. pt-fiscal composes the payload but does not generate the signature/hash; official invoices must be issued via the Portal das Finanças or AT-certified software.
Is the tax logic official?¶
No — figures and helpers are a convenience for management, not official tax advice.