Zum Hauptinhalt springen

Einführung

Versenden Sie automatisch professionelle transaktionale E-Mails, wenn Zahlungsevents auftreten. Liefern Sie Zahlungsbestätigungen, Abonnementaktualisierungen und wichtige Benachrichtigungen mit der zuverlässigen E-Mail-Infrastruktur von Resend und hervorragenden Zustellraten.
Diese Integration erfordert Ihren Resend API-Schlüssel zur Authentifizierung.

Erste Schritte

1

Webhook-Bereich öffnen

Navigieren Sie in Ihrem Dodo Payments-Dashboard zu Webhooks → + Endpoint hinzufügen und erweitern Sie das Dropdown-Menü für Integrationen.
Endpoint hinzufügen und Dropdown-Menü für Integrationen
2

Resend auswählen

Wählen Sie die Integrationskarte Resend aus.
3

API-Schlüssel eingeben

Geben Sie Ihren Resend API-Schlüssel in der Konfiguration ein.
4

Transformation konfigurieren

Bearbeiten Sie den Transformationscode, um E-Mails für die Resend-API zu formatieren.
5

Testen & Erstellen

Testen Sie mit Beispielpayloads und klicken Sie auf Erstellen, um das Versenden von E-Mails zu aktivieren.
6

Fertig!

🎉 Zahlungsevents werden jetzt automatisch transaktionale E-Mails über Resend auslösen.

Transformationscode-Beispiele

Zahlungsbestätigungs-E-Mail

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;
}

Willkommens-E-Mail für Abonnements

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;
}

Benachrichtigung über Zahlungsfehler

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;
}

Tipps

  • Verwenden Sie verifizierte Absenderdomains für bessere Zustellraten
  • Fügen Sie sowohl HTML- als auch Textversionen von E-Mails hinzu
  • Personalisieren Sie Inhalte mit Kundendaten
  • Verwenden Sie klare, handlungsorientierte Betreffzeilen
  • Fügen Sie Abmeldelinks zur Einhaltung der Vorschriften hinzu
  • Testen Sie E-Mail-Vorlagen, bevor Sie live gehen

Fehlersuche

  • Überprüfen Sie, ob der API-Schlüssel korrekt und aktiv ist
  • Stellen Sie sicher, dass die Absenderdomain in Resend verifiziert ist
  • Überprüfen Sie, ob die Empfänger-E-Mail-Adressen gültig sind
  • Überprüfen Sie die Versandlimits und Quoten von Resend
  • Validieren Sie, ob die JSON-Struktur dem Resend-API-Format entspricht
  • Überprüfen Sie, ob alle erforderlichen Felder vorhanden sind
  • Stellen Sie sicher, dass der HTML-Inhalt ordnungsgemäß formatiert ist
  • Überprüfen Sie, ob die Absender-E-Mail-Adresse verifiziert ist