=== CatCode Invoices with Holded for WooCommerce ===
Contributors: catcodestudio
Tags: holded, invoices, facturas, accounting, woocommerce
Requires at least: 6.2
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.0.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Sends WooCommerce orders to Holded as invoices and creates the customer as a contact, without duplicates, with your VAT mapping and numbering series.

== Description ==

You sell with WooCommerce and keep the books in Holded. This plugin turns each order into a Holded invoice, so nobody types it in by hand.

Holded is a third-party product. This is an independent integration, not affiliated with or endorsed by Holded Technologies SL.

= What it does =

* **Invoice from each order**, created in Holded as a draft for you to check, when the order reaches the statuses you choose.
* **Customers become contacts.** The plugin looks for the customer by tax number, or else by e-mail, and creates the contact only if there is none.
* **Existing contacts are never changed.** In Holded an update replaces the whole contact, so what your accountant keeps there stays out of reach.
* **Your VAT rates mapped to your Holded taxes.** An order with a rate that has no mapping is held back with a clear message, instead of an invoice without VAT.
* **Your numbering series.** The plugin never sets a number by hand, which is what Holded warns against.
* **Totals are checked before sending.** If the lines do not add up to what the customer paid, nothing is sent and you are told why.

= Built not to issue an invoice twice =

* Jobs wait in a queue and run one at a time.
* If Holded does not answer while an invoice is being created, the next attempt first looks for it in Holded, and creates it only if it is not there.
* A staging copy stays quiet. If the site's address changes, sending stops until you confirm that this is the real store, otherwise a test order would become a real invoice.

= Built for the Holded allowance =

Holded limits API calls per month by plan, from 500 on Starter to 100,000 on Premium, and all tools on one account share the count.

* An order costs 1 to 3 calls. Returning customers cost the fewest, because the plugin remembers their contact.
* When Holded says to wait, the plugin waits as long as it was told and keeps every job.
* The Activity tab shows the calls made this month and the jobs waiting.

= What it does not do =

* It does not submit anything to the tax authorities itself.
* It does not change or cancel a Holded invoice when an order changes afterwards. It leaves a note on the order, and the decision is yours.

= Pro =

Sold on [catcode.com.ua](https://catcode.com.ua/modules/holded-invoices-woocommerce/) with a 7-day trial:

* **Approve invoices** straight away. Off by default, so that you can check a few drafts first.
* **Record the payment** on the invoice, in the Holded account you choose for each payment method.
* **Credit notes for refunds**, by item or for an amount. Off until you switch them on: check the first ones with your accountant.
* **Stock with Holded by SKU, both ways**, for simple products and variations. Each side receives the change made on the other, so a sale made in between is not lost.
* **NIF / VAT number field at checkout**, classic and block, with the Spanish check digit validated.
* **Invoice PDF** on the order screen and, if you want, under My account > Orders.
* **Send past orders** in bulk from the orders list.
* **E-mail alerts** when Holded refuses the key, the allowance runs out or a job gives up.

Stock typed by hand in the store is not sent to Holded: manage it there. Products need a SKU on both sides, and a variable product whose stock is kept on the parent cannot match. Packs are left out.

== Installation ==

1. Install and activate the plugin. WooCommerce must be active.
2. In Holded, open Settings > Developers > Credentials and create an API key. It is shown only once.
3. Open **WooCommerce > Holded** and paste the key. It is kept encrypted with your site's keys.
4. On the **Invoices** tab choose the statuses, the numbering series and a Holded tax for each store rate.
5. Place a test order and check the draft in Holded before relying on it.

== Frequently Asked Questions ==

= Does this need a CatCode account? =

No. The plugin talks to Holded directly, with your own API key.

= Which permissions does the key need? =

The Connection tab lists them. Those that can be read are checked when you connect. Write permissions are tried on the first order, because they cannot be tested without creating something.

= Will old orders be sent when I connect? =

No. Only orders placed after connecting are sent automatically. An older one can be sent from its own screen.

= An invoice was not sent. What now? =

The Activity tab and a note on the order give the reason. Fix it and press Retry.

= I also use a VeriFactu plugin. Is that a problem? =

Choose one system to register your invoices, so that the same sale is not registered by two of them.

== External services ==

This plugin connects to the Holded API (api.holded.com), a service of Holded Technologies SL, which is what it exists for. It sends nothing until you connect an account.

* What is sent: your API key with each call. For each order: customer name, company, tax number, e-mail, phone and addresses; the order lines, prices, taxes, date and currency.
* When: when you connect or refresh the lists, and when an order reaches a status you chose.

With Pro also: payment amount, date and method when you turn on payments; refund lines when you turn on credit notes; SKUs and stock changes when you turn on stock sync.

The Pro build also connects to catcode.com.ua for the license and for updates, sending the key and the site address. [Terms](https://catcode.com.ua/terms/), [privacy policy](https://catcode.com.ua/privacy/).

Holded [legal terms](https://www.holded.com/legal) and [privacy policy](https://www.holded.com/privacy).

== Screenshots ==

1. Connecting the Holded account.
2. Numbering series and tax mapping.
3. Activity with the calls made this month.

== Changelog ==

= 1.0.1 =
* Credit notes stay off until you switch them on, with a note on why to check the first ones.

= 1.0.0 =
* First release.
