{
  "name": "SpecGrid — AEAT VeriFactu RegistroAlta XML + SEPA EPC QR (Make.com Blueprint)",
  "flow": [
    {
      "id": 1,
      "module": "gateway:CustomWebHook",
      "version": 1,
      "parameters": {},
      "mapper": {},
      "metadata": {
        "designer": { "x": 0, "y": 0 },
        "notes": "Trigger with JSON: { invoiceNumber, issueDate, supplierName, supplierTaxId, customerName, customerTaxId, netAmount, vatRate, iban }"
      }
    },
    {
      "id": 2,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": { "handleErrors": false, "useNewZLibDeCompress": true },
      "mapper": {
        "url": "https://eu.specgrid-api.workers.dev/api/v1/einvoice/generate",
        "method": "post",
        "headers": [
          { "name": "Content-Type", "value": "application/json" },
          { "name": "Authorization", "value": "Bearer SPECGRID-REPLACE-WITH-YOUR-POLAR-KEY" }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "{\"format\":\"verifactu_registro_alta\",\"invoiceNumber\":\"{{1.invoiceNumber}}\",\"issueDate\":\"{{1.issueDate}}\",\"currency\":\"EUR\",\"supplier\":{\"name\":\"{{1.supplierName}}\",\"taxId\":\"{{1.supplierTaxId}}\",\"countryCode\":\"ES\"},\"customer\":{\"name\":\"{{1.customerName}}\",\"taxId\":\"{{1.customerTaxId}}\",\"countryCode\":\"ES\"},\"lines\":[{\"description\":\"Services\",\"quantity\":1,\"unitPrice\":{{1.netAmount}},\"vatRate\":{{1.vatRate}}}]}"
      },
      "metadata": {
        "designer": { "x": 300, "y": 0 },
        "notes": "Generates AEAT VeriFactu <sf:RegistroAlta> XML, 64-hex SHA-256 Huella, ValidarQR URL, and Tributary QR SVG."
      }
    },
    {
      "id": 3,
      "module": "http:ActionSendData",
      "version": 3,
      "parameters": { "handleErrors": false, "useNewZLibDeCompress": true },
      "mapper": {
        "url": "https://eu.specgrid-api.workers.dev/api/v1/sepa/epc-qr",
        "method": "post",
        "headers": [
          { "name": "Content-Type", "value": "application/json" },
          { "name": "Authorization", "value": "Bearer SPECGRID-REPLACE-WITH-YOUR-POLAR-KEY" }
        ],
        "bodyType": "raw",
        "parseResponse": true,
        "contentType": "application/json",
        "data": "{\"beneficiaryName\":\"{{1.supplierName}}\",\"iban\":\"{{1.iban}}\",\"amountEur\":{{2.data.totals.gross}},\"remittanceText\":\"Invoice {{1.invoiceNumber}}\"}"
      },
      "metadata": {
        "designer": { "x": 600, "y": 0 },
        "notes": "Generates EPC069-12 v002 SEPA Instant Payment QR payload and SVG."
      }
    },
    {
      "id": 4,
      "module": "gateway:WebhookRespond",
      "version": 1,
      "parameters": {},
      "mapper": {
        "status": "200",
        "body": "{\"verifactuSha256\":\"{{2.data.fingerprintSha256}}\",\"aeatQrUrl\":\"{{2.data.qrValidationUrl}}\",\"verifactuXml\":\"{{2.data.xml}}\",\"sepaQrSvg\":\"{{3.data.qrSvg}}\"}",
        "headers": [{ "key": "Content-Type", "value": "application/json" }]
      },
      "metadata": { "designer": { "x": 900, "y": 0 } }
    }
  ],
  "metadata": {
    "instant": true,
    "version": 1,
    "scenario": { "roundtrips": 1, "maxErrors": 3, "autoCommit": true, "sequential": false }
  }
}
