VeriFactu on Magento.
Every paid order, an invoice registered with the AEAT.

Magento 2 · Adobe Commerce

Cofactu has no module in the Magento Marketplace, and we will not tell you otherwise. What it has is a webhook that invoices any order you send and files it with the AEAT (the Spanish Tax Agency), and Magento knows how to send it: a twenty-line observer or a Make recipe.

No native module · webhook live. Today there is no Cofactu module to install on Magento, and no date for one. What works is the universal webhook: your own observer or a Make scenario sends it each paid order.

See how it connects ↓

No native module · webhook live

What can you connect today
between Magento and Cofactu?

Today there is no Cofactu module to install on Magento, and no date for one. What works is the universal webhook: your own observer or a Make scenario sends it each paid order.

Status of the Magento integration, checked against the Cofactu code
RouteTodayWhat it does
Cofactu plugin, module or app on the Magento MarketplaceNot availableIt does not exist and has no date. There is nothing from Cofactu to install in the store.
Universal webhookAvailableInvoices every order you send and files it with the AEAT using your certificate. It needs an API key: from the SME plan or during the 30-day trial.
Direct catalogue connectionNot availableIt only exists for WooCommerce and Shopify.
Make or ZapierAvailableWith their HTTP module against the webhook. Cofactu has no app of its own in Make or Zapier.

Checked on 26 October 2026 · What is not available has no date

Order-to-AEAT flow

From a paid order in Magento
to a registered invoice.

  1. 01

    Order paid in your store

    Magento fires its payment event, as it already does today.

  2. 02

    One POST to the Cofactu webhook

    From the native hook or from Make. Normalised JSON, API key in the header.

  3. 03

    Chained invoice

    Cofactu numbers it, computes the chained SHA-256 fingerprint and generates the PDF with a QR code.

  4. 04

    Registered with the AEAT

    With your certificate, the record goes to the AEAT (the Spanish Tax Agency) in the background and the response CSV is stored.

Scroll
With code · the native hook

Observer on sales_order_invoice_pay

It fires when Magento marks the order's invoice as paid. If you take cash on delivery, switch to the sales_order_save_after event and filter by status complete.

php
<?php
// app/code/YourCompany/Cofactu/Observer/InvoicePay.php
namespace YourCompany\Cofactu\Observer;

use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\HTTP\Client\Curl;

class InvoicePay implements ObserverInterface
{
    public function __construct(private Curl $curl) {}

    public function execute(Observer $observer): void
    {
        $order = $observer->getEvent()->getInvoice()->getOrder();
        $lines = [];
        foreach ($order->getAllVisibleItems() as $item) {
            $lines[] = [
                'descripcion'    => $item->getName(),
                'cantidad'       => (float) $item->getQtyOrdered(),
                'precioUnitario' => (float) $item->getPrice(),      // excluding VAT
                'tipoIva'        => (float) $item->getTaxPercent(),
            ];
        }
        $this->curl->addHeader('Authorization', 'Bearer ' . getenv('COFACTU_API_KEY'));
        $this->curl->addHeader('Content-Type', 'application/json');
        $this->curl->post('https://api.cofactu.com/api/webhooks/ecommerce-orders', json_encode([
            'platform'        => 'magento',
            'externalOrderId' => $order->getIncrementId(),
            'client'          => $order->getCustomerTaxvat()
                ? ['nif' => $order->getCustomerTaxvat(), 'nombre' => $order->getCustomerName(), 'email' => $order->getCustomerEmail()]
                : null,                                                // simplified F2 invoice
            'lines'           => $lines,
        ]));
    }
}
No code

Without touching code: Make or Zapier

  1. Step 1

    Create an API key in Cofactu (Settings → API keys) with permission to create invoices. The API is included from the SME plan and during the 30-day trial.

  2. Step 2

    In Make, build a scenario with the “Magento 2 → Watch orders” module (or, in Zapier, “Magento 2 → New Order”).

  3. Step 3

    Add an HTTP “Make a request” module: POST to https://api.cofactu.com/api/webhooks/ecommerce-orders, header Authorization: Bearer vf_live_….

  4. Step 4

    Map the order to the JSON below. externalOrderId = order number: if Make retries, Cofactu does not duplicate the invoice.

The JSON Cofactu expects

One format for every store

POST https://api.cofactu.com/api/webhooks/ecommerce-orders with Authorization: Bearer vf_live_…. Prices exclude VAT and each line carries its tipoIva (VAT rate); client: null issues a simplified F2 invoice; externalOrderId makes the call idempotent. From Settings → Integrations → Ecommerce you can send a test order, which stays as a draft; real orders show up in Invoices with their AEAT status.

Settings → Integrations → Ecommerce ↗
json
{
  "platform": "magento",
  "externalOrderId": "2026-000123",
  "client": {
    "nif": "B12345678",
    "nombre": "Tienda Ejemplo SL",
    "email": "compras@ejemplo.com",
    "direccion": "C/ Mayor 1",
    "codigoPostal": "28001",
    "ciudad": "Madrid",
    "pais": "ES"
  },
  "lines": [
    {
      "descripcion": "Zapatillas running 42",
      "cantidad": 1,
      "precioUnitario": 79.34,
      "tipoIva": 21
    },
    {
      "descripcion": "Gastos de envío",
      "cantidad": 1,
      "precioUnitario": 4.13,
      "tipoIva": 21
    }
  ],
  "autoSubmit": true
}
Frequently asked questions

Magento and VeriFactu, in short

Does Cofactu have a VeriFactu module for Magento?

No. There is the universal webhook, which is what a module would call internally. Connecting it takes a PHP observer like the one on this page or a Make scenario. A packaged module is not available and has no date.

Does it work with Magento 2 and Adobe Commerce?

Yes. Both expose the same order and invoice events, and the POST to the webhook is a plain HTTP call. Magento 1 has been out of support since 2020 and we do not cover it.

What happens if Magento sends the same order twice?

Nothing. The webhook is idempotent by platform + externalOrderId: a second call issues nothing new: it answers with the invoice created the first time and its AEAT status.

What if the customer did not give me a tax ID (NIF)?

Send client: null and Cofactu issues a simplified invoice (type F2), which is what VeriFactu provides for sales to unidentified end consumers. The JSON is the same for all four stores: platform, externalOrderId, client (or null for a simplified F2 invoice) and lines with a price excluding VAT and a tipoIva (VAT rate) per line.

What do I need in Cofactu for the invoice to reach the AEAT?

Your digital certificate uploaded and VeriFactu switched on for the organisation. Without a certificate the invoice is still created and stays as a draft for you to send when you have one; with autoSubmit: false it stays as a draft on purpose.

Other platforms

Other platforms

  1. 01 Shopify VeriFactu on Shopify
  2. 02 WooCommerce VeriFactu on WooCommerce
  3. 03 PrestaShop VeriFactu on PrestaShop
  4. 04 Ecommerce Full ecommerce comparison
  5. 05 VeriFactu VeriFactu guide
Start with a test order

Your store stays on Magento.
The invoice, VeriFactu.

30 days with all of Cofactu, API included and no card, and a test order to see the first chained invoice. After that, the API starts at the SME plan.

See pricing ↗

(Start today)

Invoice with VeriFactu, file with the AEAT and keep your books in the same account. Start free: no card, nothing to install.

Your first invoice

  • Unlimited VeriFactu invoices with QR
  • No card needed
  • Full export of your data