Shopify Integration
From 2027, German B2B businesses must send e-invoices. If you run a Shopify store, thelawin.dev can generate a ZUGFeRD-compliant PDF for each order.
Prerequisites
- Shopify store (Basic plan or higher)
- thelawin.dev API key
- Webhook receiver (your own server, n8n, or Zapier)
Architecture
Shopify Order (paid) → Webhook
→ Middleware (n8n / Zapier / your server)
→ POST api.thelawin.dev/v1/generate
→ Email PDF to customer or save to Shopify FilesSet Up the Shopify Webhook
- Shopify Admin → Settings → Notifications → Webhooks
- Create Webhook:
- Event:
Order payment - Format: JSON
- URL: Your webhook endpoint
- Event:
Webhook → thelawin.dev (Node.js)
javascript
import { ThelawinClient } from '@thelawin/sdk';
const thelawin = new ThelawinClient(process.env.THELAWIN_API_KEY);
app.post('/webhooks/shopify/order-paid', async (req, res) => {
const order = req.body;
const items = order.line_items.map(item => ({
description: item.title,
quantity: item.quantity,
unitPrice: parseFloat(item.price),
vatRate: 19,
}));
const result = await thelawin.invoice()
.number(`RE-${order.order_number}`)
.date(order.created_at.split('T')[0])
.format('zugferd')
.locale('de')
.seller({
name: 'Dein Shop GmbH',
vatId: 'DE123456789',
street: 'Shopstrasse 1',
city: 'Berlin',
postalCode: '10115',
country: 'DE',
})
.buyer({
name: `${order.billing_address.first_name} ${order.billing_address.last_name}`,
street: order.billing_address.address1,
city: order.billing_address.city,
postalCode: order.billing_address.zip,
country: order.billing_address.country_code,
})
.items(items)
.payment({ terms: 'Already paid via Shopify' })
.generate();
if (result.success) {
console.log(`Invoice ${result.filename} created for Order #${order.order_number}`);
}
res.status(200).send('OK');
});Alternative: Shopify + n8n
Instead of running your own server, use n8n:
- Webhook Trigger | Receives Shopify order webhook
- Set Node | Extracts customer data and line items
- HTTP Request | POST to thelawin.dev
- Gmail/SMTP | Send PDF to customer
Alternative: Shopify + Zapier
- Trigger: Shopify → New Paid Order
- Action: Webhooks by Zapier → POST to thelawin.dev
- Action: Gmail → Send Email with PDF link
See the Zapier Guide for details.
German E-Invoicing Mandate (2027)
From January 2027, businesses above 800,000 EUR revenue must send e-invoices in B2B transactions. From 2028, everyone has to. thelawin.dev covers the relevant formats:
- ZUGFeRD 2.4 | PDF/A-3 with embedded CII XML
- XRechnung 3.0.2 | For government invoices (B2G) with Leitweg-ID
- Factur-X 1.0.8 | For French customers
Next Steps
- Invoice Formats | When to use which format
- WooCommerce Guide | Alternative e-commerce platform
- DATEV Guide | ZUGFeRD invoices for your tax advisor