# e-conomic: Automatic invoicing (v2)

URL: https://help.hubhus.com/kb/how-does-hubhus-integrate-with-e-conomic-v2
Category: Integrations / Accounting
Updated: 2026-11-16T08:32:11.429533+00:00

Summary: Method 1 - Automatic JSON injection: Form page writes JSON to df_e_conomic before submit. A Make scenario reads it and creates the e-conomic document. Best for complex, dynamic pricing. Method 2 - Action listener with placeholders: No custom JS needed. An action listener sends a JSON payload with Hubhus placeholders (e.g. %lead_name%) when a lead is created/updated. Best for simple, field-based invoices. Method 3 - Manual product line in Billing: Staff manually add product lines in Hubhus Billing. Invoices are sent from e-conomic at month end. Used for time registration and consultant hours. Read the linked document back: use include="economic" on &lt;hh-data.lead> or &lt;hh-data.leads>, e.g. get="economic.pdf_url", to show it in templates and dashboards.

Hubhus can send data to e-conomic in three different ways. Which one applies to you depends on how your setup is configured. This article explains all three, helps you identify which one you are using, and covers common issues for each.

## 3 integration methods to know

1. **Automatic JSON injection via df_e_conomic**. A JavaScript block on the Hubhus page builds a JSON object (customer, product lines, pricing) and writes it to the Data Field `df_e_conomic` just before form submit. An external automation (typically Make) listens for new leads with this field populated and calls the e-conomic API. Use this when you need dynamic per-line pricing or complex calculations based on user input.
2. **Action listener with Hubhus placeholders**. No custom page code is required. An action or webhook listener sends a JSON payload with Hubhus placeholders (e.g. `%lead_name%`, `%lead_email%`) that Hubhus substitutes with real lead values before dispatching the request. Simpler to configure but less flexible for multi-line or computed invoices.
3. **Manual product line in Hubhus Billing**. Staff manually add billable product lines against a customer in Hubhus Billing - for example, consultant hours or development time. At month end (last day), all draft invoices are sent from e-conomic. This is an internal time registration process and does not involve any automated form trigger.

**Read more**

Method 1: JSON structure for df_e_conomic

The `df_e_conomic` Data Field stores a single JSON object per submission. Minimal required structure:

```
{ "type": "order",
  "customer": { "name": "...", "email": "...", "address": "...", "zip": "...", "city": "..." },
  "lines": [
    { "product": { "productNumber": "600" }, "quantity": 1, "unitNetPrice": 1250.00, "description": "..." }
  ],
  "notes": { "heading": "Order ref", "textLine1": "Lead ID" }
}
```

**Key rules:** `quantity` must be positive (zero/negative is rejected). `productNumber` must exist in your e-conomic account. `unitNetPrice` is net (excl. VAT).

**Deletion flow:** To delete an existing draft, set `"hubhusEconomicAction": "delete"` in the JSON. Your Make scenario must check for this key before attempting to create a new order.

Method 2: Example payload with Hubhus placeholders

```
{ "type": "order",
  "customer": { "name": "%lead_name%", "email": "%lead_email%",
    "telephoneAndFaxNumber": "%lead_phone%", "address": "%lead_street_address%",
    "zip": "%lead_postal_code%", "city": "%lead_city_name%" },
  "lines": [ { "product": { "productNumber": "600" }, "quantity": 1,
    "unitNetPrice": 0, "description": "..." } ],
  "notes": { "heading": "Order - %lead_name%", "textLine1": "Lead ID: %lead_id%" }
}
```

Use Method 2 when the invoice content is straightforward and expressible with standard lead fields. Use Method 1 when pricing depends on form inputs or requires multiple dynamic lines.

Method 3: Adding a manual product line (step by step)

1. Go to the billing campaign. If the customer exists as a lead, skip to step 5. Otherwise click **New order**.
2. In the modal, click **Select existing customer**.
3. Search for the customer by name. If not found, check **Billing → Edit e-conomic customer mappings**.
4. Select the customer and click **Create order**. Wait for the order to appear.
5. On the customer page, click **Add product** in the centre panel.
6. Search for and select the relevant product (e.g. consultant hours).
7. Edit the description: _today's date · requester at customer · brief task description · reference_. Click the blue checkmark to save.
8. Repeat steps 5-7 for each billable item. On the last day of the month, send all draft invoices from e-conomic.

### Using the linked e-conomic document in templates and dashboards

When a lead is linked to an e-conomic document, templates and dashboards can read that document with `include="economic"` on `<hh-data.lead>`, `<hh-data.leads>` and `<hh-data.leads.first>`. The document is placed under the key `economic` on the lead. This reads data back from e-conomic. It is not a fourth way to send data.

- **One field on the current lead:** `<hh-data.lead include="economic" get="economic.pdf_url" />`. Start the path in `get` with `economic.`, because `get` starts at the lead. `get="pdf_url"` returns nothing.
- **Lists and dashboards:** loop over `<hh-data.leads>` with `include="economic"` and use e.g. `{order.economic.totals.net}`. Each lead in the list has its own `economic` object, so use a loop, an array index, `array-filter` or `pluck` instead of a plain `get`. `<hh-data.leads>` returns 25 leads by default and at most 500 with `limit`.
- **Totals:** `sum="economic.totals.net"` adds up the net amounts of the leads in the list without a loop.
- **vs. {{eco_*}} placeholders:** `{{eco_number}}`, `{{eco_pdf_url}}` and the other `{{eco_*}}` placeholders work only on the current lead, not per lead in a loop. The delivery address is not in the `economic` object, so `{{eco_delivery_*}}` on the current lead is the only way to show it.
- **No lines:** quote, order and invoice lines are not included, so the data stays small enough for placeholders.
- **Customer-facing output:** fetch only the fields you need with `get`. The full `economic` object contains financial and customer data, and `pdf_url` is a signed link that should only go to the customer it belongs to.

```
<hh-data.lead include="economic" get="economic.number" />
<hh-data.lead include="economic" get="economic.totals.gross" />
<hh-data.lead include="economic" get="economic.debtor.name" />

<hh-for each="order" in='<hh-data.leads campaign="12345" include="economic" />'>
  {order.economic.number}: {order.economic.totals.net}
</hh-for>

Total net: <hh-data.leads campaign="12345" include="economic" sum="economic.totals.net" />
```

Replace `12345` with your campaign ID. Available paths:

| Path | Value |
| --- | --- |
| `economic.type` | `quotation`, `order` or `booked-invoice` |
| `economic.number` | Document number |
| `economic.date`, `.due_date`, `.delivery_date` | Dates in ISO format. `delivery_date` can be empty. |
| `economic.currency` | Currency code, e.g. `DKK` or `EUR` |
| `economic.vat_included`, `.sent`, `.archived` | true or false |
| `economic.reference`, `.note` | Text, can be empty |
| `economic.pdf_url` | Signed link to the PDF |
| `economic.totals.net`, `.vat`, `.gross`, `.rounding`, `.margin`, `.margin_percent` | Amounts |
| `economic.debtor.number`, `.name`, `.email`, `.phone`, `.address`, `.postal_code`, `.city`, `.ean` | The customer (debtor). Email, phone and EAN can be empty. |
| `economic.employee.number`, `.name`, `.email`, `.phone` | The e-conomic employee. Email and phone can be empty. |

Fields can be empty, so check them with `@if` before you use them. See also [HH Components Reference Guide](https://help.hubhus.com/kb/hh-components-reference-guide) and [e-conomic: Invoice campaign best practices](https://help.hubhus.com/kb/e-conomic-invoice-campaign-best-practices).

### Common issues

| Symptom | Likely cause |
| --- | --- |
| Nothing created in e-conomic | Make scenario not active, filter on wrong field, or `df_e_conomic` is empty / invalid JSON. |
| Error: product not found | `productNumber` does not exist in your e-conomic account, or wrong environment (test vs. production). |
| Error: invalid quantity | `quantity` is 0 or negative, or an empty line was included in `lines`. |
| Wrong price or VAT amount | `unitNetPrice` must be net. If the page shows VAT-inclusive prices, divide by the VAT factor in JS before writing. |
| Customer not found (Method 3) | Name differs between Hubhus and e-conomic. Check **Billing → Edit e-conomic customer mappings**. |
| e-conomic value is empty in a template | `include="economic"` is missing, the `get` path does not start with `economic.`, or the lead is not linked to an e-conomic document. |
| `{{eco_*}}` is empty in a lead list | `{{eco_*}}` placeholders only work on the current lead. Use `include="economic"` and e.g. `{order.economic.totals.net}`. |

**When reporting an error:** Include the raw JSON from `df_e_conomic` on the affected lead, the lead ID, timestamp, and the full error message from Make or e-conomic.

## Related articles

- https://help.hubhus.com/kb/how-do-i-integrate-with-e-conomic-v1
- https://help.hubhus.com/kb/e-conomic-invoice-campaign-best-practices
- https://help.hubhus.com/kb/hubhus-integrations-overview
- https://help.hubhus.com/kb/fortnox-direct-integration
- https://help.hubhus.com/kb/hh-components-reference-guide
