8
n8n 한국어amn8n.com

Stripe 결제 트리거 및 Gmail을 사용하여 PDF 인보이스 자동 발송

초급

이것은Invoice Processing, Multimodal AI분야의자동화 워크플로우로, 5개의 노드를 포함합니다.주로 Code, Gmail, Webhook 등의 노드를 사용하며. Stripe 결제 트리거 및 Gmail을 사용하여 PDF 인voice 자동 발송

사전 요구사항
  • Google 계정 및 Gmail API 인증 정보
  • HTTP Webhook 엔드포인트(n8n이 자동으로 생성)

사용된 노드 (5)

워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc"
  },
  "nodes": [
    {
      "id": "3c9c65d5-e8ef-472b-994f-14d67bf92479",
      "name": "설치 지침",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 280,
        "height": 200,
        "content": "💰 **SETUP REQUIRED:**\n\n1. **Stripe Webhook:**\n   - Go to Stripe Dashboard → Webhooks\n   - Add endpoint with webhook URL below\n   - Select event: payment_intent.succeeded\n\n2. **Gmail Setup:**\n   - Connect Gmail OAuth in credentials\n   - Emails sent from your Gmail account\n\n3. **Customize Invoice:**\n   - Update company name in 'Generate Invoice HTML'\n   - Modify invoice template as needed\n\n🎯 Invoices auto-generated as PDF attachments!"
      },
      "typeVersion": 1
    },
    {
      "id": "9d2296bf-2617-4b8c-9d5b-ff87e3cf8360",
      "name": "Stripe 결제 웹훅",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        224
      ],
      "webhookId": "stripe-payment-webhook",
      "parameters": {
        "path": "stripe-webhook",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1
    },
    {
      "id": "25314ce6-fbec-41b1-9328-2e075eb658a2",
      "name": "결제 데이터 정규화",
      "type": "n8n-nodes-base.code",
      "position": [
        208,
        224
      ],
      "parameters": {
        "jsCode": "// Normalize Stripe payment data\nconst event = $input.first().json;\nconst paymentIntent = event.data?.object || event;\n\n// Only proceed if this is a successful payment\nif (event.type !== 'payment_intent.succeeded' && event.type !== 'charge.succeeded') {\n  console.log('Not a successful payment event, skipping...');\n  return null;\n}\n\n// Extract payment and customer details\nconst normalizedData = {\n  payment_id: paymentIntent.id,\n  amount: paymentIntent.amount / 100, // Convert from cents\n  currency: paymentIntent.currency?.toUpperCase() || 'USD',\n  customer_email: paymentIntent.receipt_email || paymentIntent.billing_details?.email || '',\n  customer_name: paymentIntent.billing_details?.name || 'Valued Customer',\n  payment_date: new Date(paymentIntent.created * 1000).toISOString(),\n  description: paymentIntent.description || 'Service Payment',\n  invoice_number: `INV-${Date.now()}`,\n  status: 'paid'\n};\n\n// Validate required fields\nif (!normalizedData.customer_email) {\n  throw new Error('Customer email is required for invoice generation');\n}\n\nconsole.log('Normalized Payment Data:', normalizedData);\n\nreturn {\n  json: normalizedData\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "8439384c-a885-4ad5-bc5d-e587b667fe61",
      "name": "송장 HTML 생성",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        224
      ],
      "parameters": {
        "jsCode": "// Generate HTML invoice content\nconst data = $input.first().json;\n\nconst invoiceHTML = `\n<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"utf-8\">\n  <style>\n    body { font-family: Arial, sans-serif; margin: 40px; }\n    .header { text-align: center; margin-bottom: 40px; }\n    .invoice-details { margin: 30px 0; }\n    .amount { font-size: 24px; font-weight: bold; color: #2E7D32; }\n    table { width: 100%; border-collapse: collapse; margin: 20px 0; }\n    th, td { padding: 12px; text-align: left; border-bottom: 1px solid #ddd; }\n    .footer { margin-top: 50px; text-align: center; color: #666; }\n  </style>\n</head>\n<body>\n  <div class=\"header\">\n    <h1>INVOICE</h1>\n    <h2>Your Company Name</h2>\n  </div>\n  \n  <div class=\"invoice-details\">\n    <p><strong>Invoice #:</strong> ${data.invoice_number}</p>\n    <p><strong>Date:</strong> ${new Date(data.payment_date).toLocaleDateString()}</p>\n    <p><strong>Payment ID:</strong> ${data.payment_id}</p>\n  </div>\n  \n  <div>\n    <h3>Bill To:</h3>\n    <p><strong>${data.customer_name}</strong></p>\n    <p>${data.customer_email}</p>\n  </div>\n  \n  <table>\n    <thead>\n      <tr>\n        <th>Description</th>\n        <th>Amount</th>\n        <th>Status</th>\n      </tr>\n    </thead>\n    <tbody>\n      <tr>\n        <td>${data.description}</td>\n        <td class=\"amount\">${data.currency} ${data.amount.toFixed(2)}</td>\n        <td style=\"color: green; font-weight: bold;\">PAID</td>\n      </tr>\n    </tbody>\n  </table>\n  \n  <div class=\"footer\">\n    <p>Thank you for your business!</p>\n    <p>This invoice was automatically generated.</p>\n  </div>\n</body>\n</html>\n`;\n\nreturn {\n  json: {\n    ...data,\n    invoice_html: invoiceHTML,\n    filename: `invoice_${data.invoice_number}.pdf`\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "7cb20e9e-dec4-4c7b-9029-05f3ddd5ef0a",
      "name": "송장 이메일 발송",
      "type": "n8n-nodes-base.gmail",
      "position": [
        608,
        224
      ],
      "webhookId": "6a6f3511-443a-4ff0-bd1b-c1a6b3890e98",
      "parameters": {
        "message": "Dear {{ $json.customer_name }},\\n\\nThank you for your payment! Please find your invoice attached.\\n\\nPayment Details:\\n- Amount: {{ $json.currency }} {{ $json.amount }}\\n- Payment ID: {{ $json.payment_id }}\\n- Date: {{ $json.payment_date }}\\n\\nBest regards,\\nYour Company Name",
        "options": {
          "attachmentsUi": {
            "attachmentsBinary": [
              {
                "property": "invoice_pdf"
              }
            ]
          }
        },
        "subject": "Invoice {{ $json.invoice_number }} - Payment Confirmation"
      },
      "typeVersion": 2.1
    }
  ],
  "pinData": {},
  "connections": {
    "8439384c-a885-4ad5-bc5d-e587b667fe61": {
      "main": [
        [
          {
            "node": "7cb20e9e-dec4-4c7b-9029-05f3ddd5ef0a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "25314ce6-fbec-41b1-9328-2e075eb658a2": {
      "main": [
        [
          {
            "node": "8439384c-a885-4ad5-bc5d-e587b667fe61",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9d2296bf-2617-4b8c-9d5b-ff87e3cf8360": {
      "main": [
        [
          {
            "node": "25314ce6-fbec-41b1-9328-2e075eb658a2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

초급 - 청구서 처리, 멀티모달 AI

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
초급
노드 수5
카테고리2
노드 유형4
난이도 설명

n8n 초보자를 위한 1-5개 노드의 간단한 워크플로우

저자
David Olusola

David Olusola

@dae221

I help ambitious businesses eliminate operational bottlenecks and scale faster with AI automation. My clients typically see 40-60% efficiency gains within 90 days. Currently accepting 3 new projects this quarter - david@daexai.com

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34