Magento Integration
Coming SoonAdobe Commerce e-invoice module. Enterprise-ready for high order volumes and multi-store setups.
Magento 2 Extension in Development
Our official Magento 2 Extension is currently in development. In the meantime, you can integrate Invoice-api.xhub via Magento Observer or the REST/GraphQL API.
Features
Adobe Commerce
Native integration for Magento 2 and Adobe Commerce
Multi-Store
E-invoices for all store views and websites
Enterprise-Ready
Scalable for high order volumes and B2B
GraphQL API
Modern integration via Magento GraphQL
Observer Integration
Available Events
Use Magento events to create e-invoices based on shop events.
sales_order_invoice_save_afterInvoice created in Magento
sales_order_payment_payPayment received
checkout_submit_all_afterCheckout completed
sales_order_save_commit_afterOrder saved
1<?php2// Magento 2 Observer für E-Rechnung3// app/code/Xhub/EInvoice/Observer/InvoiceSaveAfter.php4 5namespace Xhub\EInvoice\Observer;6 7use Magento\Framework\Event\Observer;8use Magento\Framework\Event\ObserverInterface;9 10class InvoiceSaveAfter implements ObserverInterface11{12 private $invoiceService;13 14 public function __construct(15 \Xhub\EInvoice\Service\InvoiceService $invoiceService16 ) {17 $this->invoiceService = $invoiceService;18 }19 20 public function execute(Observer $observer)21 {22 $invoice = $observer->getEvent()->getInvoice();23 $order = $invoice->getOrder();24 25 // Nur für B2B mit USt-ID26 $vatId = $order->getBillingAddress()->getVatId();27 if (empty($vatId)) {28 return;29 }30 31 // E-Rechnung erstellen32 $this->invoiceService->createEInvoice($order, $invoice);33 }34}REST API Integration
Alternatively, you can use the Magento REST API and connect with n8n or Make.com.
- 1
Create Webhook in Magento
Or observer for sales_order_invoice_save_after
- 2
Fetch Order Data
GET /rest/V1/orders/:orderId
- 3
Transform Data
Magento format → Invoice-api.xhub format
- 4
Create E-Invoice
POST /api/v1/invoice/de/xrechnung/generate to Invoice-api.xhub API
1// Magento REST API → Invoice-api.xhub2// Integration über Magento Webhooks oder Observer3 4const magentoOrder = await fetch(5 `${MAGENTO_URL}/rest/V1/orders/${orderId}`,6 { headers: { Authorization: `Bearer ${MAGENTO_TOKEN}` }}7).then(r => r.json());8 9const invoiceData = {10 type: "xrechnung-3.0",11 seller: {12 name: storeConfig.general.store_information.name,13 vatId: storeConfig.general.store_information.merchant_vat_number,14 address: {15 street: storeConfig.general.store_information.street_line1,16 city: storeConfig.general.store_information.city,17 zip: storeConfig.general.store_information.postcode,18 country: storeConfig.general.store_information.country_id19 }20 },21 buyer: {22 name: magentoOrder.billing_address.company23 || `${magentoOrder.billing_address.firstname} ${magentoOrder.billing_address.lastname}`,24 vatId: magentoOrder.billing_address.vat_id,25 address: {26 street: magentoOrder.billing_address.street.join(", "),27 city: magentoOrder.billing_address.city,28 zip: magentoOrder.billing_address.postcode,29 country: magentoOrder.billing_address.country_id30 }31 },32 items: magentoOrder.items.map(item => ({33 description: item.name,34 quantity: item.qty_ordered,35 unitPrice: parseFloat(item.price),36 vat: parseFloat(item.tax_percent)37 })),38 reference: magentoOrder.increment_id39};40 41const response = await fetch('https://service.invoice-api.xhub.io/api/v1/invoice/de/xrechnung/generate', {42 method: 'POST',43 headers: {44 'Authorization': `Bearer ${XHUB_API_KEY}`,45 'Content-Type': 'application/json'46 },47 body: JSON.stringify(invoiceData)48});Use Cases
B2B Marketplace
E-invoices for B2B platforms with vendor management
- 1Vendor creates order
- 2Magento processes B2B checkout
- 3XRechnung with vendor data
- 4Automatic Peppol delivery
Multi-Store Enterprise
Central e-invoice for all store views
- 1Order in any store
- 2Store-specific seller data
- 3Unified e-invoice format
- 4Central archiving
Adobe Commerce B2B
Integration with Magento B2B features
- 1Company account with VAT ID
- 2Requisition list order
- 3XRechnung with cost center
- 4Purchase order reference