Skip to content

SfepEmitirFactura

Issues an Electronic Invoice (FE) to Panama’s DGI under the SFEP model (Sistema de Factura Electrónica de Panamá): Internal Operation (01), Import (02) or Export (03). The node builds the FE XML with issuer data (taken from the credential) and receiver data, optionally signs it if an issuer certificate is loaded, and sends it to the PAC (Proveedor Autorizado de Certificación, e.g. The Factory HKA) configured in the credential.

If there is no issuer certificate, the PAC signs the document as part of the authorization service. Once authorized, the FE is identified by its CUFE (Código Único de Factura Electrónica), and the PAC also returns the CAFE (printable representation) and the QR URL. ITBMS is calculated at 7%.

FieldTypeRequiredDescription
credentials_idcredentialsYesSFEP credential
facturajsonNoInvoice (JSON): tipo (01/02/03), receptor (ruc, dv, nombre — omit for final consumer), items (precioUnitario without ITBMS, tasaItbms 01=7%). If omitted, the input data is used

This module requires an sfep credential type with the following fields:

  • Issuer RUC and business name: identify the taxpayer issuing the FE.
  • PAC provider: e.g. thefactoryhka or another generic adapter (which also requires the PAC URL).
  • PAC token or username: access credentials for the authorization service.
  • Certificate (.p12) (optional): if loaded, the FE is signed locally before sending; otherwise the PAC signs it.
  • Environment: test or production.
{
"numero": "0000123",
"puntoFacturacion": "001",
"tipo": "01",
"estado": "authorized",
"cufe": "FE0120000000000001000012320260805...",
"cafeUrl": "https://pac.example.pa/cafe/FE01200000...",
"qrUrl": "https://pac.example.pa/qr/FE01200000...",
"total": 1120.5,
"itbms": 70.5
}
{
"credentials_id": "cred-sfep-prod",
"factura": {
"tipo": "01",
"receptor": {
"ruc": "8-888-8888",
"dv": "77",
"nombre": "Consumidor Final"
},
"items": [
{
"descripcion": "Automation service",
"cantidad": 1,
"precioUnitario": 1050,
"tasaItbms": "01"
}
]
}
}
  • If factura is not sent in the configuration, the node uses the full object received in data as the invoice.
  • The node rejects the request if tipo is not 01, 02 or 03, or if items is empty.
  • For a final consumer, the receptor object can be omitted.
  • The returned cufe is the value to save in order to issue credit/debit notes, cancel the FE, or generate its representation (CAFE/QR).