Docs/Integrations/PrestaShop
PrestaShop

PrestaShop Integration

Coming Soon

Open-source e-commerce with e-invoicing. Ideal for the European market with Factur-X and XRechnung support.

PrestaShop Module in Development

Our official PrestaShop Module is currently in development. In the meantime, you can integrate Invoice-api.xhub via PrestaShop Hooks or the Webservice.

Features

Open Source

Module code available for individual customization

EU-Widespread

Ideal for European e-commerce requirements

Multi-Shop

E-invoices for all PrestaShop multi-stores

Hook-Based

Integration via the PrestaShop hook system

Hook Integration

Available Hooks

Use PrestaShop hooks to create e-invoices based on shop events.

actionValidateOrder

Order validated

actionOrderStatusUpdate

Order status changed

actionPaymentConfirmation

Payment confirmed

actionObjectOrderInvoiceAddAfter

Invoice created

php
1<?php
2// PrestaShop Modul für E-Rechnung
3// modules/xhubeinvoice/xhubeinvoice.php
4 
5class XhubEInvoice extends Module
6{
7 public function __construct()
8 {
9 $this->name = 'xhubeinvoice';
10 $this->version = '1.0.0';
11 $this->author = 'invoice-api.xhub';
12 parent::__construct();
13 }
14 
15 public function install()
16 {
17 return parent::install()
18 && $this->registerHook('actionPaymentConfirmation')
19 && $this->registerHook('actionOrderStatusUpdate');
20 }
21 
22 public function hookActionPaymentConfirmation($params)
23 {
24 $order = new Order($params['id_order']);
25 $customer = new Customer($order->id_customer);
26 $address = new Address($order->id_address_invoice);
27 
28 // Nur für B2B mit USt-ID
29 if (empty($address->vat_number)) {
30 return;
31 }
32 
33 $this->createEInvoice($order, $customer, $address);
34 }
35 
36 private function createEInvoice($order, $customer, $address)
37 {
38 $invoiceData = [
39 'type' => 'xrechnung-3.0',
40 'seller' => $this->getSellerData(),
41 'buyer' => [
42 'name' => $address->company ?: $customer->firstname . ' ' . $customer->lastname,
43 'vatId' => $address->vat_number,
44 'address' => [
45 'street' => $address->address1,
46 'city' => $address->city,
47 'zip' => $address->postcode,
48 'country' => Country::getIsoById($address->id_country)
49 ]
50 ],
51 'items' => $this->getOrderItems($order),
52 'reference' => $order->reference
53 ];
54 
55 // API Call zu Invoice-api.xhub
56 $this->callXhubApi($invoiceData);
57 }
58}

Webservice Integration

Alternatively, you can use the PrestaShop Webservice and connect with n8n or Make.com.

  1. 1

    Enable Webservice

    Admin → Advanced Parameters → Webservice

  2. 2

    Create API Key

    With access to Orders, Customers, Addresses

  3. 3

    Create n8n Workflow

    Webhook → Fetch order → Transform → E-invoice

  4. 4

    Create E-Invoice

    POST /api/v1/invoice/de/xrechnung/generate to Invoice-api.xhub API

typescript
1// PrestaShop Webservice → n8n → Invoice-api.xhub
2// Alternative: PrestaShop REST API nutzen
3 
4// 1. PrestaShop Webservice aktivieren
5// Admin → Erweiterte Parameter → Webservice
6 
7// 2. API-Schlüssel mit Order-Zugriff erstellen
8 
9// 3. n8n Workflow:
10// - Trigger: Webhook von PrestaShop
11// - HTTP Request: Order-Details abrufen
12// - Transform: PrestaShop → Invoice-api.xhub Format
13// - HTTP Request: E-Rechnung erstellen
14 
15const prestashopOrder = await fetch(
16 `${PS_URL}/api/orders/${orderId}?output_format=JSON`,
17 { headers: { Authorization: `Basic ${PS_API_KEY}` }}
18).then(r => r.json());
19 
20const invoiceData = {
21 type: "zugferd-2.1",
22 seller: {
23 name: shopConfig.PS_SHOP_NAME,
24 vatId: shopConfig.PS_SHOP_VAT,
25 address: {
26 street: shopConfig.PS_SHOP_ADDR1,
27 city: shopConfig.PS_SHOP_CITY,
28 zip: shopConfig.PS_SHOP_CODE,
29 country: shopConfig.PS_SHOP_COUNTRY
30 }
31 },
32 buyer: {
33 name: prestashopOrder.order.associations.customer.company
34 || `${prestashopOrder.order.associations.customer.firstname} ${prestashopOrder.order.associations.customer.lastname}`,
35 vatId: prestashopOrder.order.associations.address_invoice.vat_number,
36 address: {
37 street: prestashopOrder.order.associations.address_invoice.address1,
38 city: prestashopOrder.order.associations.address_invoice.city,
39 zip: prestashopOrder.order.associations.address_invoice.postcode,
40 country: prestashopOrder.order.associations.address_invoice.id_country
41 }
42 },
43 items: prestashopOrder.order.associations.order_rows.map(row => ({
44 description: row.product_name,
45 quantity: parseInt(row.product_quantity),
46 unitPrice: parseFloat(row.unit_price_tax_excl),
47 vat: 19
48 })),
49 reference: prestashopOrder.order.reference
50};

Use Cases

EU Trade

E-invoices for European B2B trade

  1. 1EU customer with VAT ID orders
  2. 2PrestaShop detects B2B customer
  3. 3Create XRechnung/Factur-X
  4. 4Delivery via Peppol EU-wide

Multi-Shop EU

Central e-invoice for all EU shops

  1. 1Order in any shop
  2. 2Country-specific tax data
  3. 3Unified e-invoice format
  4. 4OSS-compliant archiving

Dropshipping

E-invoices for dropshipping models

  1. 1Customer orders in shop
  2. 2Supplier receives order
  3. 3E-invoice to end customer
  4. 4Separate supplier billing

Want to be notified when the module is available?

Sign up and we will notify you as soon as the official PrestaShop Module is available in the PrestaShop Addons Marketplace.