메인 콘텐츠로 건너뛰기

소개

결제 이벤트가 발생할 때 전문적인 거래 이메일을 자동으로 전송합니다. Resend의 신뢰할 수 있는 이메일 인프라와 우수한 배달률을 통해 결제 확인, 구독 업데이트 및 중요한 알림을 전달하세요.
이 통합은 인증을 위해 Resend API 키가 필요합니다.

시작하기

1

웹훅 섹션 열기

Dodo Payments 대시보드에서 Webhooks → + Add Endpoint로 이동하고 통합 드롭다운을 확장합니다.
Add Endpoint and integrations dropdown
2

Resend 선택

Resend 통합 카드를 선택합니다.
3

API 키 입력

구성에서 Resend API 키를 제공합니다.
4

변환 구성

Resend의 API에 맞게 이메일 형식을 조정하기 위해 변환 코드를 편집합니다.
5

테스트 및 생성

샘플 페이로드로 테스트하고 Create를 클릭하여 이메일 전송을 활성화합니다.
6

완료!

🎉 이제 결제 이벤트가 자동으로 Resend를 통해 거래 이메일을 트리거합니다.

변환 코드 예제

결제 확인 이메일

payment_confirmation.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    webhook.url = "https://api.resend.com/emails";
    webhook.payload = {
      from: "[email protected]",
      to: [p.customer.email],
      subject: "Payment Confirmation - $" + (p.total_amount / 100).toFixed(2),
      html: `
        <h2>Payment Successful!</h2>
        <p>Hi ${p.customer.name},</p>
        <p>Your payment of $${(p.total_amount / 100).toFixed(2)} has been processed successfully.</p>
        <ul>
          <li><strong>Payment ID:</strong> ${p.payment_id}</li>
          <li><strong>Amount:</strong> $${(p.total_amount / 100).toFixed(2)}</li>
          <li><strong>Date:</strong> ${new Date(webhook.payload.timestamp).toLocaleDateString()}</li>
          <li><strong>Method:</strong> ${p.payment_method || "Unknown"}</li>
        </ul>
        <p>Thank you for your business!</p>
      `,
      text: `Payment Successful! Your payment of $${(p.total_amount / 100).toFixed(2)} has been processed. Payment ID: ${p.payment_id}`
    };
  }
  return webhook;
}

구독 환영 이메일

subscription_welcome.js
function handler(webhook) {
  if (webhook.eventType === "subscription.active") {
    const s = webhook.payload.data;
    webhook.url = "https://api.resend.com/emails";
    webhook.payload = {
      from: "[email protected]",
      to: [s.customer.email],
      subject: "Welcome to Your Subscription!",
      html: `
        <h2>Welcome to Your Subscription!</h2>
        <p>Hi ${s.customer.name},</p>
        <p>Your subscription has been activated successfully.</p>
        <ul>
          <li><strong>Subscription ID:</strong> ${s.subscription_id}</li>
          <li><strong>Product:</strong> ${s.product_id}</li>
          <li><strong>Amount:</strong> $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}</li>
          <li><strong>Next Billing:</strong> ${new Date(s.next_billing_date).toLocaleDateString()}</li>
        </ul>
        <p>You can manage your subscription anytime from your account dashboard.</p>
      `,
      text: `Welcome! Your subscription is now active. Amount: $${(s.recurring_pre_tax_amount / 100).toFixed(2)}/${s.payment_frequency_interval}`
    };
  }
  return webhook;
}

결제 실패 알림

payment_failure.js
function handler(webhook) {
  if (webhook.eventType === "payment.failed") {
    const p = webhook.payload.data;
    webhook.url = "https://api.resend.com/emails";
    webhook.payload = {
      from: "[email protected]",
      to: [p.customer.email],
      subject: "Payment Failed - Action Required",
      html: `
        <h2>Payment Failed</h2>
        <p>Hi ${p.customer.name},</p>
        <p>We were unable to process your payment of $${(p.total_amount / 100).toFixed(2)}.</p>
        <ul>
          <li><strong>Payment ID:</strong> ${p.payment_id}</li>
          <li><strong>Amount:</strong> $${(p.total_amount / 100).toFixed(2)}</li>
          <li><strong>Error:</strong> ${p.error_message || "Payment processing failed"}</li>
        </ul>
        <p>Please update your payment method or contact support for assistance.</p>
        <a href="https://yourdomain.com/update-payment">Update Payment Method</a>
      `,
      text: `Payment Failed: We couldn't process your $${(p.total_amount / 100).toFixed(2)} payment. Please update your payment method.`
    };
  }
  return webhook;
}

  • 더 나은 배달률을 위해 검증된 발신자 도메인을 사용하세요
  • 이메일의 HTML 및 텍스트 버전을 모두 포함하세요
  • 고객 데이터로 콘텐츠를 개인화하세요
  • 명확하고 행동 지향적인 제목을 사용하세요
  • 준수를 위해 구독 취소 링크를 포함하세요
  • 라이브 전 이메일 템플릿을 테스트하세요

문제 해결

  • API 키가 올바르고 활성화되어 있는지 확인하세요
  • 발신자 도메인이 Resend에서 검증되었는지 확인하세요
  • 수신자 이메일 주소가 유효한지 확인하세요
  • Resend 전송 한도 및 쿼터를 검토하세요
  • JSON 구조가 Resend API 형식과 일치하는지 검증하세요
  • 모든 필수 필드가 있는지 확인하세요
  • HTML 콘텐츠가 올바르게 형식화되었는지 확인하세요
  • 발신 이메일 주소가 검증되었는지 확인하세요