Docs/Integrations/PrestaShop
P

PrestaShop Integration

Coming Soon

Open-Source E-Commerce mit E-Rechnung. Ideal für den europäischen Markt mit Factur-X und XRechnung Support.

PrestaShop Modul in Entwicklung

Unser offizielles PrestaShop Modul ist aktuell in Entwicklung. In der Zwischenzeit kannst du invoice.xhub über PrestaShop Hooks oder den Webservice integrieren.

Features

Open Source

Modul-Code verfügbar für individuelle Anpassungen

EU-verbreitet

Ideal für europäische E-Commerce Anforderungen

Multi-Shop

E-Rechnungen für alle PrestaShop Multi-Stores

Hook-basiert

Integration über das PrestaShop Hook-System

Hook Integration

Verfügbare Hooks

Nutze PrestaShop Hooks um E-Rechnungen basierend auf Shop-Events zu erstellen.

actionValidateOrder

Bestellung wurde validiert

actionOrderStatusUpdate

Bestellstatus geändert

actionPaymentConfirmation

Zahlung bestätigt

actionObjectOrderInvoiceAddAfter

E-Rechnung erstellt

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.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.xhub
56 $this->callXhubApi($invoiceData);
57 }
58}

Webservice Integration

Alternativ kannst du den PrestaShop Webservice nutzen und mit n8n oder Make.com verbinden.

  1. 1

    Webservice aktivieren

    Admin → Erweiterte Parameter → Webservice

  2. 2

    API-Schlüssel erstellen

    Mit Zugriff auf Orders, Customers, Addresses

  3. 3

    n8n Workflow erstellen

    Webhook → Order abrufen → Transform → E-Rechnung

  4. 4

    E-Rechnung erstellen

    POST /api/v1/invoice/de/xrechnung/generate an invoice.xhub API

typescript
1// PrestaShop Webservice → n8n → invoice.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.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};

Anwendungsfälle

EU-Handel

E-Rechnungen für den europäischen B2B-Handel

  1. 1EU-Kunde mit USt-ID bestellt
  2. 2PrestaShop erkennt B2B-Kunde
  3. 3XRechnung/Factur-X erstellen
  4. 4Versand via Peppol EU-weit

Multi-Shop EU

Zentrale E-Rechnung für alle EU-Shops

  1. 1Bestellung in beliebigem Shop
  2. 2Länderspezifische Steuerdaten
  3. 3Einheitliches E-Rechnungsformat
  4. 4OSS-konforme Archivierung

Dropshipping

E-Rechnungen für Dropshipping-Modelle

  1. 1Kunde bestellt im Shop
  2. 2Supplier erhält Auftrag
  3. 3E-Rechnung an Endkunde
  4. 4Separate Supplier-Abrechnung

Benachrichtigt werden wenn das Modul verfügbar ist?

Trage dich ein und wir informieren dich sobald das offizielle PrestaShop Modul im PrestaShop Addons Marketplace verfügbar ist.