SUNAT Peru — Electronic Invoicing (CPE, UBL 2.1)
Overview
Section titled “Overview”The SUNAT nodes connect your workflows with Peru’s electronic invoicing (Electronic Payment Receipts, CPE). Floogos builds the document in UBL 2.1 (the international standard), signs it, zips it and sends it over SOAP to SUNAT or your OSE, reading the CDR (acknowledgment).
| Node | What it does |
|---|---|
SUNAT: Issue invoice/boleta (sunatEmitirCPE) | Issues invoice (01) or boleta (03) → CDR |
SUNAT: Credit/debit note (sunatEmitirNota) | Issues CN (07) or DN (08) referencing the original |
SUNAT: Daily boletas summary (sunatResumenBoletas) | Reports the day’s boletas → ticket |
SUNAT: Query ticket (sunatConsultarTicket) | Gets the CDR of a ticket (summary/void) |
SUNAT: Representation / QR (sunatRepresentacion) | Generates the printable receipt with QR |
Credential
Section titled “Credential”The nodes use a SUNAT credential. Create it under Credentials → Add → Peru SUNAT / CPE with:
| Field | Description |
|---|---|
| Certificate (.p12) | Your digital certificate, base64. |
| Certificate password | The .p12 password. |
| RUC and Legal name | Issuer data (11-digit RUC). |
| SOL user and SOL password | The SOL secondary user. The WS uses {RUC}{SOL_USER} as the username. |
| Mode | Direct to SUNAT or via OSE (+ OSE URL). |
| Environment | Beta (homologation) or Production. |
The full flow
Section titled “The full flow”-
Prepare the CPE as JSON (type, series, number, recipient, items with
valorUnitariowithout IGV). -
Issue with Issue invoice/boleta. Floogos builds the UBL, signs it, compresses it and sends it; SUNAT returns the CDR (accepted/rejected).
-
For retail boletas, use Daily boletas summary (once a day) and then Query ticket.
-
Generate the printable representation with Representation / QR.
Issuing an invoice or boleta
Section titled “Issuing an invoice or boleta”Node: SUNAT: Issue invoice/boleta. Example of an invoice:
{ "tipo": "01", "serie": "F001", "numero": 1, "receptor": { "tipoDoc": "6", "numDoc": "20111111112", "razonSocial": "Cliente SAC" }, "items": [ { "descripcion": "Product", "cantidad": 2, "valorUnitario": 50, "tipoAfectacion": "10" } ]}valorUnitario is without IGV; Floogos computes the IGV (18%). tipoAfectacion: 10 taxed, 20 exempt, 30 unaffected.
Credit and debit notes
Section titled “Credit and debit notes”Credit/debit note issues a CN (07) or DN (08) that references the original document (docRef) and carries the reason (catalog 09/10):
{ "tipo": "07", "serie": "FC01", "numero": 1, "motivo": "01", "motivoDescripcion": "Operation cancellation", "docRef": { "tipo": "01", "serie": "F001", "numero": 1 }, "receptor": { "tipoDoc": "6", "numDoc": "20111111112" }, "items": [ { "descripcion": "Product", "cantidad": 1, "valorUnitario": 100, "tipoAfectacion": "10" } ]}Boletas: daily summary
Section titled “Boletas: daily summary”Consumer boletas are reported via a daily summary (asynchronous). Daily boletas summary sends the summary and returns a ticket; with Query ticket you get the CDR once SUNAT finishes processing it. Ideal for a scheduled workflow once a day.
Printable representation (QR)
Section titled “Printable representation (QR)”Representation / QR generates the printable receipt in HTML (exportable to PDF), with the SUNAT QR (string RUC|type|series|number|IGV|total|date|receiverDocType|receiverDocNumber|hash).
Error handling
Section titled “Error handling”| Situation | Retryable | What to do |
|---|---|---|
| CDR rejected | No | The node returns SUNAT’s code/description. Fix the CPE. |
| Expired certificate | No | Renew the .p12 and update the credential. |
| Network / Timeout | Yes | Transient issue; retried automatically. |
See also
Section titled “See also”- Retry queue (DLQ) — how failed executions are retried.
- HTTP node — for services not covered by these nodes.