=== Facturalo.pe for WooCommerce ===
Contributors: facturalope
Tags: sunat, peru, electronic invoicing, invoice, boleta
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Issue Peruvian SUNAT electronic invoices and receipts (boleta and factura) from your WooCommerce store, automatically when an order is completed.

== Description ==

**Facturalo.pe for WooCommerce** connects your WooCommerce store with SUNAT (Peru) to issue
**electronic invoices (factura) and receipts (boleta)** automatically. When an order reaches
the status you choose (Completed by default), the plugin builds the document from the order
data and sends it to **Facturalo.pe**, which files it with SUNAT. SUNAT's response (accepted
or rejected) and the PDF and XML links are stored on the order.

It is designed for Peruvian online stores that use WooCommerce and need **SUNAT electronic
invoicing** without manual work: the customer chooses receipt or invoice at checkout, enters
their DNI or RUC, pays, and receives the document by e-mail.

You need an active Facturalo.pe account and an API key. Get one at
[https://facturalo.pe](https://facturalo.pe).

= What this plugin does =

* **Automatic emission** of a boleta (with DNI) or a factura (with RUC) when an order reaches
  the trigger status.
* **Checkout fields** (WooCommerce Checkout block): the customer chooses the document type and
  enters their DNI or RUC; for a factura, also the business name and fiscal address. With
  on-screen validation (DNI = 8 digits, RUC = 11 digits).
* **Test (demo) and Live environments**, each with its own API key and its own document series.
* **Per-series, per-environment correlativo counter**, kept inside WordPress.
* **"Facturalo.pe" admin screen**: list of issued documents, their SUNAT status, a "Check
  status" action, and per-order status with an "Issue now" button to retry.
* **"Download document (PDF)" link** in My Account (orders list and order detail) and in the
  customer order e-mails.
* Compatible with WooCommerce **High-Performance Order Storage (HPOS)**.

= Who is it for =

WooCommerce stores in Peru that issue electronic documents to SUNAT: e-commerce selling
physical or digital products, services, or subscriptions. If you already use Facturalo.pe for
your invoicing, this plugin automates emission from WooCommerce.

= Keywords =

WooCommerce electronic invoicing Peru, SUNAT invoice WooCommerce, boleta electronica
WooCommerce, factura electronica WooCommerce, Peru e-invoicing plugin, Facturalo WooCommerce
integration.

== External service ==

This plugin sends data to the Facturalo.pe API to issue electronic documents.

* Service: Facturalo.pe - https://facturalo.pe
* Endpoint (default, configurable): https://api.facturalo.pe
* Data sent when issuing a document: the customer's tax document type and number, name,
  address, e-mail, the order line items (description, quantity, unit price) and totals, and
  the API key you configured. The PDF/XML links returned by the API point to that same service.
* No data is sent until you enable automatic emission and configure an API key.
* Terms of service: https://facturalo.pe/terminos
* Privacy policy: https://facturalo.pe/privacidad

== Installation ==

1. Install and activate WooCommerce, and use the WooCommerce Checkout **block** on your
   checkout page.
2. Upload the plugin ZIP under **Plugins > Add New > Upload Plugin**, or copy the
   `facturalo-pe-for-woocommerce` folder to `wp-content/plugins/`.
3. Activate **Facturalo.pe for WooCommerce**.
4. Go to **WooCommerce > Facturalo.pe > Settings**.
5. Choose the environment, enter your API key (`sk_test_...` for demo, `sk_live_...` for
   production), set the boleta and factura series, pick the trigger status and enable
   automatic emission.

The "Informacion del comprobante" block is added to your checkout automatically.

== Frequently Asked Questions ==

= Do I need a Facturalo.pe account? =

Yes. This plugin is only the connector; the electronic documents are issued by Facturalo.pe
to SUNAT. Create an account and get an API key at https://facturalo.pe.

= Does it issue both boleta and factura? =

Yes. The customer chooses at checkout. Boleta with a DNI (or without a document, as "public");
factura with a RUC, business name and fiscal address.

= Which series should I use? =

Use a series that only WooCommerce issues (for example F900 / B900). The plugin keeps its own
correlativo counter; if another system issues on the same series, SUNAT will reject the
duplicated correlativos.

= What happens if emission fails? =

The order gets a note with the error, the status is marked as "error", and an "Issue now"
button appears to retry after fixing the data. The exact payload and response are shown under
"Technical detail" on the order.

= Does the customer need an account to download the document? =

No. The Facturalo.pe PDF URL is public; the link is shown on the order and in the e-mail.

= Does it work with the classic (shortcode) checkout? =

The fiscal fields are implemented as a WooCommerce Checkout **block**. Use the block-based
checkout page for the full experience.

= Is it free? =

The plugin is free and open source (GPL). Documents are issued with your Facturalo.pe account,
which has its own plan.

== Screenshots ==

1. Checkout: the customer chooses boleta or factura and enters the DNI or RUC.
2. Plugin settings: environment, API keys, series and defaults.
3. Admin list of issued documents with their SUNAT status.
4. Per-order Facturalo.pe status, with PDF download and retry.

== Changelog ==

= 1.0.0 =
* Initial release: automatic emission of SUNAT boletas and facturas from WooCommerce through the Facturalo.pe API v3.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
