SfepEmitirFactura
Description
Section titled “Description”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%.
Configuration
Section titled “Configuration”| Field | Type | Required | Description |
|---|---|---|---|
| credentials_id | credentials | Yes | SFEP credential |
| factura | json | No | Invoice (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 |
Credentials
Section titled “Credentials”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.
thefactoryhkaor 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:
testorproduction.
Output
Section titled “Output”{ "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}Usage Example
Section titled “Usage Example”{ "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
facturais not sent in the configuration, the node uses the full object received indataas the invoice. - The node rejects the request if
tipois not 01, 02 or 03, or ifitemsis empty. - For a final consumer, the
receptorobject can be omitted. - The returned
cufeis the value to save in order to issue credit/debit notes, cancel the FE, or generate its representation (CAFE/QR).
Related Nodes
Section titled “Related Nodes”- SfepEmitirNota - Issue a credit/debit note referencing this invoice
- SfepAnular - Cancel an already authorized FE
- SfepRepresentacion - Generate the printable representation (CAFE) with QR