{
  "name": "RenderHub: Webhook to Invoice PDF (Base64 & Email Attachment)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "renderhub-invoice",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000001",
      "name": "Webhook Trigger",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300],
      "webhookId": "renderhub-invoice-webhook"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://render.softwarehub.vn/v1/invoice",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_RENDERHUB_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"invoiceNumber\": \"{{ $json.body?.invoiceNumber || 'INV-2026-001' }}\",\n  \"issueDate\": \"{{ $json.body?.issueDate || '2026-11-22' }}\",\n  \"dueDate\": \"{{ $json.body?.dueDate || '2026-11-29' }}\",\n  \"status\": \"{{ $json.body?.status || 'PAID' }}\",\n  \"currency\": \"{{ $json.body?.currency || 'USD' }}\",\n  \"from\": {\n    \"name\": \"{{ $json.body?.from?.name || 'SoftwareHub Co., Ltd.' }}\",\n    \"email\": \"billing@softwarehub.vn\",\n    \"taxId\": \"077201002677\"\n  },\n  \"to\": {\n    \"name\": \"{{ $json.body?.to?.name || 'Acme SaaS Inc.' }}\",\n    \"email\": \"{{ $json.body?.to?.email || 'accounts@acme.example' }}\"\n  },\n  \"items\": {{ JSON.stringify($json.body?.items || [{ description: 'RenderHub Growth Pack (12,000 credits)', quantity: 1, unitPrice: 29 }]) }},\n  \"taxRatePercent\": {{ $json.body?.taxRatePercent ?? 10 }},\n  \"notes\": \"Thank you for your business. Generated automatically via RenderHub /v1/invoice.\",\n  \"format\": \"A4\",\n  \"responseFormat\": \"json\"\n}",
        "options": {
          "timeout": 30000
        }
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000002",
      "name": "Render Invoice PDF",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "base64",
        "binaryPropertyName": "data",
        "options": {
          "fileName": "={{ $json.filename || 'invoice.pdf' }}",
          "mimeType": "={{ $json.contentType || 'application/pdf' }}"
        }
      },
      "id": "a1b2c3d4-0001-4000-8000-000000000003",
      "name": "Convert to PDF File",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [760, 300]
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook Trigger": {
      "main": [
        [
          {
            "node": "Render Invoice PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Render Invoice PDF": {
      "main": [
        [
          {
            "node": "Convert to PDF File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1.0.0",
  "meta": {
    "templateCredsSetupCompleted": false,
    "instanceId": "renderhub-n8n-blueprint-invoice"
  },
  "tags": ["renderhub", "invoice", "pdf"]
}
