How to Connect WooCommerce with SUNAT Electronic Invoicing: A Technical Guide Without Slow Intermediaries
Learn how to issue automatic electronic receipts and invoices (XML and PDF) in WooCommerce connected to SUNAT or via an OSE. Save hundreds of accounting hours every month.

The Accounting Headache of a Growing E-commerce Store
One of the most rewarding milestones for any company in Peru is when its online store starts generating steady sales—ten, twenty, fifty orders a day coming in through the website. However, that initial excitement quickly turns into an operational nightmare for the administrative and accounting team if invoicing is still handled manually.
The traditional manual workflow is unsustainable: someone has to log into SUNAT's Clave SOL portal or a disconnected external invoicing tool, copy each customer's details one by one from the WooCommerce dashboard, type in the DNI or RUC, copy every product description and unit price, calculate the IGV, issue the tax document, download both the PDF and XML files to their computer, and finally email them to the customer.
Not only does this process burn through dozens of productive work hours every week, it is also a constant source of costly human error: receipts issued with wrong amounts, breaks in sequential numbering, and frustrated customers chasing their invoices to claim monthly business expenses.
The definitive solution is to automate the connection between WooCommerce and SUNAT's electronic invoicing system. In this technical guide, we explain how the integration architecture works and outline the best options available in the Peruvian market.
How Does Electronic Invoicing Architecture Work in Peru?
In Peru, electronic payment vouchers are not simple visual PDF documents; they are structured text files in XML format following the international UBL (Universal Business Language 2.1) standard, which must meet two mandatory technical requirements:
1. Digital Signature with a Tax Digital Certificate: The XML file must be cryptographically signed using a digital certificate issued in the company's name, guaranteeing the document's authenticity and immutability.
2. Submission and Validation with SUNAT or an OSE: The signed file is transmitted to SUNAT's servers or to an authorized Electronic Services Operator (OSE). If the voucher complies with all tax rules, the authority returns a Confirmation of Receipt (CDR) with an "Accepted" status.
The Two Integration Paths for WooCommerce
There are two technical routes to connect your WooCommerce store to the electronic invoicing ecosystem:
Option A: API Connection Through an Electronic Services Provider (PSE / OSE)
This is the most recommended and stable option for the vast majority of commercial businesses:
Option B: Integrated In-House Invoicing Engine (Direct Submission to SUNAT)
Recommended for large enterprises or platforms with very high transaction volumes (thousands of receipts per month):
Mandatory Fields Your WooCommerce Store Must Capture
For the issued receipt (boleta) or invoice (factura) to be 100% valid before the Peruvian tax authority, your store's checkout form must be tailored to capture the required data:
The Step-by-Step Automated Flow for the Customer
Once the professional integration is configured, the entire cycle completes in under 3 seconds with zero human intervention:
1. The customer completes payment on the site using their credit card or Yape.
2. WooCommerce detects payment confirmation and triggers a secure webhook.
3. The system generates the XML, digitally signs it, and sends it to SUNAT/OSE.
4. SUNAT validates the voucher and returns the CDR (Confirmation of Receipt).
5. WooCommerce automatically attaches the PDF of the receipt/invoice and the XML download link to the order confirmation email sent to the customer.
6. In your company's admin panel, the order is tagged with its official series number (for example: F001-0004523) for effortless accounting reconciliation.
Conclusion
Automating electronic invoicing in WooCommerce is not a technical luxury—it is the only way a digital store can scale its sales without collapsing under bureaucratic bottlenecks and tax errors. At Conexión Digital MM, we connect your e-commerce store to SUNAT electronic invoicing with clean code, real-time RUC validation, and guaranteed operational stability.