facturama
Facturama PAC adapters (Multiemisor and API Web).
Facturama seals and stamps from a JSON payload. Pre-signed XML stamp is not supported by their public Multiemisor/Web JSON APIs.
Supported TipoDeComprobante: I, E, T, P (Pagos 2.0), N (Nómina 1.2).
Item CFDIs may include:
- Carta Porte 3.1 (NameId 36) — Multiemisor and Web
- Donativos (NameId 9) — Multiemisor and Web
- Leyendas fiscales (TaxLegends)
- Impuestos locales (via item Taxes with IsFederalTax: false)
- Comercio exterior 2.0 (NameId 26) — API Web only (FacturamaWeb)
Docs: https://apisandbox.facturama.mx/guias
- satcfdi.pacs.facturama.cfdi_to_facturama_payload(cfdi: CFDI, *, allow_foreign_trade: bool = False) dict[source]
Map a satcfdi CFDI (typically unsigned) to Facturama JSON.
- Parameters:
allow_foreign_trade – Enable Comercio Exterior mapping (API Web only).
- class satcfdi.pacs.facturama.Facturama(username: str, password: str, environment=Environment.PRODUCTION)[source]
Bases:
PACFacturama Multiemisor API adapter.
Facturama is a billing platform that seals+stamps via Multiemisor; CSD files must be uploaded first (see
upload_csd()).Comercio exterior is not available on Multiemisor; use
FacturamaWeb.Documentation: https://apisandbox.facturama.mx/guias/api-multi/proceso-facturacion
- RFC = None
- property host: str
- upload_csd(rfc: str, certificate: bytes, key: bytes, password: str | bytes) dict[source]
Upload issuer CSD required before Multiemisor issue().
- list_cfdis(*, keyword: str | None = None, status: str = 'all') list[dict][source]
List CFDIs (optionally filtered by keyword / UUID).
- issue(cfdi: CFDI, accept: Accept = <Accept.XML: 1>) Document[source]
Seal and stamp via Facturama.
The local CFDI does not need to be signed; Facturama seals with the uploaded CSD (Multiemisor) or account fiscal profile (API Web).
- stamp(cfdi: CFDI, accept: Accept = <Accept.XML: 1>) Document[source]
Operation to request sealed CFDI be stamped by PAC :param accept: :param cfdi: :return: document_id and bytes of stamped xml
- recover(document_id: str, accept: Accept = <Accept.XML: 1>) Document[source]
- Parameters:
accept
document_id
- Returns:
- send_email(document_id: str, email: str, *, cfdi_type: str | None = None) dict | None[source]
Send a stamped CFDI by email through Facturama.
- cancel(cfdi: CFDI, reason: CancelReason, substitution_id: str = None, signer: Signer = None, document_id: str = None) CancelationAcknowledgment[source]
Cancel a Facturama CFDI.
Resolves Facturama Id from
document_idor from the CFDI UUID (Complemento.TimbreFiscalDigital.UUID) viafind_id_by_uuid().
- class satcfdi.pacs.facturama.FacturamaWeb(username: str, password: str, environment=Environment.PRODUCTION)[source]
Bases:
FacturamaFacturama API Web adapter (single-issuer account fiscal profile).
Unlike Multiemisor, API Web does not require per-RFC CSD upload via
upload_csd()(CSD lives on the Facturama account). It is also the only Facturama mode that supports Comercio Exterior.Documentation: https://apisandbox.facturama.mx/guias/api-web/cfdi/factura