Payment and e-CF
Payment.status only answers whether monetary authorization was recorded. FiscalDocument has its own lifecycle: requested, processing, delayed, unavailable, issued, rejected, or operator_required. Never use verifying for the fiscal document; that state belongs to Payment.
An issued document requires eNcf, issuedAt, and signed-document metadata. Printed representation and email delivery have independent states. A succeeded payment does not mean the e-CF exists, and a fiscal failure does not change the payment to declined or trigger an automatic refund.
Retrieve the related document and act on its state:
import { createTimbroPayments } from "@timbro/payments";
const secretKey = process.env.TIMBRO_PAYMENTS_SECRET_KEY;if (!secretKey) throw new Error("Missing TIMBRO_PAYMENTS_SECRET_KEY");const timbro = createTimbroPayments({ secretKey });const document = await timbro.fiscalDocuments.retrieve("fiscal_document_123");For unavailable or delayed, wait for the next opportunity and retrieve again; for rejected, correct by creating a new revision; for operator_required, stop automatic retries and assign intervention. Record fiscal_document.issued, fiscal_document.rejected, and fiscal_document.operator_required, but use retrieval as the authority.