Peru
In Peru, Floogos connects directly to SUNAT (Superintendencia Nacional de Aduanas y de Administración Tributaria) to issue Electronic Payment Receipts (CPE). There is no mandatory intermediate provider like in other countries: the engine itself builds the XML, signs it with the issuer’s certificate, and speaks SUNAT’s SOAP protocol (or that of the OSE the client chooses).
Integration model
Section titled “Integration model”- Direct, no mandatory PAC: the flow can go straight to SUNAT or through an OSE (Electronic Services Operator), depending on how the credential is configured.
- UBL 2.1 format: documents (invoices, boletas, notes) are built as UBL 2.1 XML, the standard SUNAT uses.
- Digital signature: the XML is signed inside the UBLExtensions with the issuer’s certificate (.p12) before sending.
- ZIP packaging: the signed XML travels inside a ZIP file with a normalized name (RUC-tipo-serie-numero), as required by SUNAT.
- SOAP submission: the ZIP is sent over SOAP to SUNAT’s services (sendBill for individual documents, sendSummary for summaries).
- CDR (acknowledgment receipt): SUNAT’s response includes a ZIP with the CDR, which is unpacked and parsed to determine whether the document was accepted, observed or rejected.
- 18% IGV: the General Sales Tax is calculated at 18% on the sale value excluding tax.
When a document becomes valid
Section titled “When a document becomes valid”A CPE is not valid just by being sent: it only becomes valid once the CDR returned by SUNAT states an accepted status (or accepted with observations). If SUNAT rejects the submission, the document has no tax validity and must be corrected and resent.
The special case of boletas
Section titled “The special case of boletas”Boletas de venta can be reported in two ways:
- Individually, with the same node used to issue invoices (
SunatEmitirCPE), valid in the testing environment or for low volume. - Through a daily summary, grouping all of a day’s boletas into a single submission (
SunatResumenBoletas). In this case SUNAT does not return the CDR immediately: it returns a ticket that must be queried afterward withSunatConsultarTicketto get the actual result.
Available nodes
Section titled “Available nodes”| Node | Description |
|---|---|
| SunatEmitirCPE | Issues invoice (01) or boleta (03) in UBL 2.1, signs, packages and sends over SOAP; reads the CDR |
| SunatEmitirNota | Issues a credit (07) or debit (08) note referencing the original document |
| SunatResumenBoletas | Sends the daily boletas summary (SummaryDocuments) and returns a ticket |
| SunatConsultarTicket | Queries a summary or void ticket; returns the CDR once processed |
| SunatRepresentacion | Generates the printable representation (HTML/PDF) with the document’s QR code |
Typical flow
Section titled “Typical flow”- SunatEmitirCPE — issues the invoice, or the note (
SunatEmitirNota), or boletas are accumulated during the day to be reported together. - SunatResumenBoletas — (only for boletas by summary) sent once a day, on a schedule.
- SunatConsultarTicket — the summary ticket is queried until SUNAT finishes processing it and returns the CDR.
- SunatRepresentacion — the HTML with the QR code is generated to hand the customer their printed or PDF receipt.
- The
sunatcredential type stores the certificate (.p12), its password, the issuer’s RUC, the SOL user and password, the mode (direct or OSE) and the environment (beta or production). - The Floogos engine validates that the certificate is not expired before attempting to sign and send a document.