How we issue electronic invoices and receipts straight to SUNAT
How we integrated PorPartidaDoble with SUNAT: UBL 2.1 XML, signing with the client's own certificate, CDR, credit notes, voids and detracciones. What works today and what is missing.
By Cristiam Castillo · · 4 min read
PorPartidaDoble started as an accounting system. In 2026 we rewrote it from scratch and added what people asked for most: issuing electronic invoices (facturas) and receipts (boletas), so that each one can eventually become a journal entry. This is what we built and what we learned integrating with SUNAT, Peru's tax authority.
The model: the taxpayer's own system
PorPartidaDoble issues as SEE – Del contribuyente: each business signs with its own Certificado Digital Tributario (CDT, free, issued by RENIEC) and sends with its own secondary SOL user. We are not a PSE or an OSE, and we don't sign with a certificate of ours: every issue is an act of the taxpayer.
The certificate and the SOL user are stored encrypted, and the client can revoke the secondary user at SUNAT whenever they want.
What happens when someone issues an invoice
- Draft and review. Pick the series, customer and lines. Before issuing you see the next number, the date, the amounts (base, IGV, total) and a warning if the customer is not activo and habido.
- Numbering. The sequential number is reserved only when issuing.
- UBL 2.1 XML of the factura (01) or boleta (03), with the amount in words.
- XMLDSig signature with the client's certificate.
- Sent to SUNAT through its web service (
sendBill), and the CDR (the proof of receipt) is read and stored with the document. - PDF with QR code and bank accounts, and optional email to the customer with the XML and CDR attached.

What it covers today
| Need | How we solve it |
|---|---|
| Correct or cancel | Credit note (07) and void notice (comunicación de baja) for facturas, with the ticket checked at SUNAT |
| Invoice in dollars | The document keeps SUNAT's selling exchange rate for its date |
| Detracciones (SPOT) | Catalog 54 codes, rates and the S/ 700 threshold; declared inside the XML |
| Customer data | The name is filled in from SUNAT's reduced RUC registry |
| Registers | Monthly sales and purchases registers, exportable to CSV |
| SIRE | Review and accept SUNAT's proposals from the app |
What the test environment taught us
Writing this down would have saved us days, so here it is:
- The XML ZIP must be built with the real sizes; with a streaming writer SUNAT answers that the
UBLVersionIDtag doesn't exist. - Facturas need the payment terms (
cac:PaymentTerms, Contado) or they are rejected with error 3244. - The CDR ZIP starts with an empty directory entry: walk the entries to find the
R-*.xml. - RENIEC certificates use RC2-40-CBC, which OpenSSL 3 no longer loads by default.
- SUNAT checks the issue date against Lima time: an evening document, in UTC, would be dated tomorrow.
- There is no longer a prior homologation or per-series authorization; it is enough to indicate in SOL that you issue from the taxpayer's own system.
Where we are today
Factura, boleta, credit note, void notice and a factura with detracción (in soles and dollars) were accepted by SUNAT's test environment. Moving to production is enabled by an administrator once the business completes its checklist: certificate, authorization, verified SOL user and a series. Z-Nexus, our own company, will be the first to issue in production.
Still missing: the daily summary of boletas, debit notes and the PLE export. We will build them in the order users ask for them.
Who it is for
Small businesses and sole proprietors who today invoice from SUNAT's portal or pay an invoicing provider, and want their sales, purchases and accounting to live together. If you also want to know which books apply to you under your tax regime, read what accounting each kind of company keeps in Peru.
Try it at porpartidadoble.com or write to us if you need a custom integration.
Meet PorPartidaDoble
How we integrated PorPartidaDoble with SUNAT: UBL 2.1 XML, signing with the client's own certificate, CDR, credit notes, voids and detracciones. What works today and what is missing.