Skip to content

SUNAT Peru — Electronic Invoicing (CPE, UBL 2.1)

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).

NodeWhat 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

The nodes use a SUNAT credential. Create it under Credentials → Add → Peru SUNAT / CPE with:

FieldDescription
Certificate (.p12)Your digital certificate, base64.
Certificate passwordThe .p12 password.
RUC and Legal nameIssuer data (11-digit RUC).
SOL user and SOL passwordThe SOL secondary user. The WS uses {RUC}{SOL_USER} as the username.
ModeDirect to SUNAT or via OSE (+ OSE URL).
EnvironmentBeta (homologation) or Production.
  1. Prepare the CPE as JSON (type, series, number, recipient, items with valorUnitario without IGV).

  2. Issue with Issue invoice/boleta. Floogos builds the UBL, signs it, compresses it and sends it; SUNAT returns the CDR (accepted/rejected).

  3. For retail boletas, use Daily boletas summary (once a day) and then Query ticket.

  4. Generate the printable representation with Representation / QR.

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/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" } ]
}

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.

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).

SituationRetryableWhat to do
CDR rejectedNoThe node returns SUNAT’s code/description. Fix the CPE.
Expired certificateNoRenew the .p12 and update the credential.
Network / TimeoutYesTransient issue; retried automatically.