{
  "name": "Cake Merchant — Customer Email Receipt",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "cakemerchant-receipt",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "b1b2c3d4-0002-4000-8000-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [250, 300],
      "webhookId": "cakemerchant-email-receipt"
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" },
          "conditions": [
            {
              "id": "has-email",
              "leftValue": "={{ $json.body.data.metadata.buyer_fields.email }}",
              "rightValue": "",
              "operator": { "type": "string", "operation": "isNotEmpty" }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "b1b2c3d4-0002-4000-8000-000000000002",
      "name": "Has Email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [480, 300]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "id": "to", "name": "toEmail", "value": "={{ $json.body.data.metadata.buyer_fields.email }}", "type": "string" },
            { "id": "subj", "name": "subject", "value": "=Payment Confirmed — {{ $json.body.data.metadata.description }}", "type": "string" },
            { "id": "body", "name": "htmlBody", "value": "=<h2>Payment Receipt</h2><p>Thank you for your payment!</p><table style=\"border-collapse:collapse;\"><tr><td style=\"padding:4px 12px;font-weight:bold;\">Charge ID</td><td style=\"padding:4px 12px;\">{{ $json.body.data.id }}</td></tr><tr><td style=\"padding:4px 12px;font-weight:bold;\">Amount</td><td style=\"padding:4px 12px;\">${{ $json.body.data.amount }} {{ $json.body.data.currency }}</td></tr><tr><td style=\"padding:4px 12px;font-weight:bold;\">XMR Amount</td><td style=\"padding:4px 12px;\">{{ $json.body.data.amount_xmr }} XMR</td></tr><tr><td style=\"padding:4px 12px;font-weight:bold;\">Date</td><td style=\"padding:4px 12px;\">{{ $json.body.data.confirmed_at }}</td></tr><tr><td style=\"padding:4px 12px;font-weight:bold;\">Description</td><td style=\"padding:4px 12px;\">{{ $json.body.data.metadata.description }}</td></tr></table><p style=\"margin-top:1rem;color:#888;font-size:0.85rem;\">Powered by Cake Merchant</p>", "type": "string" }
          ]
        },
        "options": {}
      },
      "id": "b1b2c3d4-0002-4000-8000-000000000003",
      "name": "Format Receipt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [710, 200]
    },
    {
      "parameters": {
        "sendTo": "={{ $json.toEmail }}",
        "subject": "={{ $json.subject }}",
        "emailType": "html",
        "html": "={{ $json.htmlBody }}",
        "options": {}
      },
      "id": "b1b2c3d4-0002-4000-8000-000000000004",
      "name": "Send Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [940, 200],
      "credentials": {
        "smtp": {
          "id": "CREDENTIAL_ID",
          "name": "SMTP — replace with your mail server credentials"
        }
      }
    },
    {
      "parameters": {
        "respondWith": "text",
        "responseBody": "OK"
      },
      "id": "b1b2c3d4-0002-4000-8000-000000000005",
      "name": "Respond OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [1170, 300]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [{ "node": "Has Email?", "type": "main", "index": 0 }]
      ]
    },
    "Has Email?": {
      "main": [
        [{ "node": "Format Receipt", "type": "main", "index": 0 }],
        [{ "node": "Respond OK", "type": "main", "index": 0 }]
      ]
    },
    "Format Receipt": {
      "main": [
        [{ "node": "Send Email", "type": "main", "index": 0 }]
      ]
    },
    "Send Email": {
      "main": [
        [{ "node": "Respond OK", "type": "main", "index": 0 }]
      ]
    }
  },
  "pinData": {},
  "settings": { "executionOrder": "v1" },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "updatedAt": "2026-02-15T00:00:00.000Z",
  "versionId": "1"
}
