{
  "name": "Stripe / Shopify to EU Peppol BIS 3.0 XML (InvoiceSpec Hub)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "stripe-invoice-webhook",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "1. Stripe / Shopify Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [240, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://invoicespec.dev/api/v1/normalize",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "x-api-key",
              "value": "isk_live_REPLACE_WITH_YOUR_KEY"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"action\": \"convert_json\",\n  \"target_format\": \"peppol-ubl\",\n  \"erp_json\": {{ JSON.stringify($json.body || $json) }}\n}",
        "options": {}
      },
      "id": "invoicespec-compile",
      "name": "2. Compile EN 16931 UBL XML (InvoiceSpec)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [520, 300]
    },
    {
      "parameters": {
        "operation": "toText",
        "sourceProperty": "remediatedXml",
        "binaryPropertyName": "data",
        "options": {
          "fileName": "={{ 'peppol-' + ($json.invoice_number || 'invoice') + '.xml' }}",
          "mimeType": "application/xml"
        }
      },
      "id": "xml-file",
      "name": "3. Convert to .XML File Attachment",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [800, 300]
    }
  ],
  "connections": {
    "1. Stripe / Shopify Webhook": {
      "main": [
        [
          {
            "node": "2. Compile EN 16931 UBL XML (InvoiceSpec)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Compile EN 16931 UBL XML (InvoiceSpec)": {
      "main": [
        [
          {
            "node": "3. Convert to .XML File Attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
