=== Bilteo for WooCommerce ===
Contributors: samirhp
Tags: woocommerce, invoices, verifactu, spain, accounting
Requires at least: 6.5
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Invoice your WooCommerce orders in Bilteo, with Verifactu. Invoice on payment, credit note on refund, hands-off.

== Description ==

Connects your WooCommerce store to [Bilteo](https://bilteo.es) so you stop turning orders into invoices by hand.

Bilteo is a Spanish invoicing service, and this plugin is aimed at shops that invoice under Spanish tax rules (NIF, IVA, Verifactu). The plugin interface is in Spanish.

* **Invoices on payment.** When an order reaches the status you pick, Bilteo issues its invoice using your own numbering series.
* **Credit notes on refund.** A refund — whole or for a single product — issues its credit note, correctly linked to the original invoice.
* **Verifactu.** If you have it enabled in Bilteo, every invoice enters your record book and is submitted to the Spanish tax agency (Agencia Tributaria).
* **Your VAT, untouched.** Invoices carry the rates and amounts your store calculated. Bilteo does not recalculate anything.
* **NIF field at checkout**, validating DNI, CIF and NIE check digits. If you already have one from another plugin, that one is used instead.
* **Nothing gets invoiced twice.** Orders that could not be invoiced are listed with the reason, and can be retried in bulk.

= What you need =

A Bilteo account and an API key.

1. Sign up at [panel.bilteo.es/registro](https://panel.bilteo.es/registro) — free, no card.
2. In Bilteo, go to **Ajustes → API** and create a key.
3. Paste it into WooCommerce → Bilteo.

The plugin links to both places from its settings screen, so you can do it as you go.

= Sales outside Spain =

Orders carrying another country's VAT (One-Stop Shop / OSS) are **not invoiced** yet: that tax is declared on Spanish form 369, which Bilteo does not cover. The order gets a note explaining it and no invoice, so it cannot slip into your quarterly return by mistake.

= External service =

This plugin sends data to Bilteo (https://panel.bilteo.es), a service operated by the plugin author. It is required for the plugin to work: invoices are issued and stored there, not in WordPress.

Data is sent when an order reaches the configured status, when a refund is created, and when you use the plugin's settings or pending-orders screens. What is sent, per order: its number and date; each line's description, quantity, unit price and VAT rate; and the billing name, company, tax ID (NIF), email, address, city, province, postcode and country. The order's wp-admin edit link is sent too, so the invoice can link back to it — that link is only ever shown to you, never to the customer.

Nothing is sent until you enter an API key.

* Terms: https://panel.bilteo.es/legal/condiciones
* Privacy policy: https://panel.bilteo.es/legal/privacidad

== Installation ==

1. Install and activate the plugin.
2. Go to WooCommerce → Bilteo and paste your API key.
3. Pick the invoicing series and the order status that triggers invoicing.

== Frequently Asked Questions ==

= Can the same order be invoiced twice? =

No. The order stores its invoice, and Bilteo rejects any repeat of the same reference, so neither a retry nor a double click issues a second one.

= What happens to an order with no tax ID? =

It is not invoiced, and the order note says so. Bilteo issues full invoices, and a full invoice identifies who receives it. You can require the NIF at checkout from the settings — it is on by default.

= Can I invoice an old order? =

Yes: on the order screen, "Facturar en Bilteo" in the actions dropdown. There is also a screen listing every order without an invoice, with the reason for each, and a button to invoice them all.

= Can I connect more than one store to the same Bilteo account? =

Yes. Each store uses its own API key, and you give each key a name so you can tell the invoices apart in Bilteo.

= Does my customer get the invoice? =

Yes, if you want. The invoice can be attached to WooCommerce's own order email, and a link to it appears on the order in My Account.

== Changelog ==

= 1.0.1 =
* The settings screen now links to Bilteo: one link to create the API key, and one to sign up if you don't have an account yet.
* The "What you need" section spells out the three steps, with the sign-up link.

= 1.0.0 =
* First release.
