Introduction

Send transactional emails and manage customer communication automatically when payment events occur. Deliver payment confirmations, subscription updates, and important notifications with Loops’ email infrastructure.
This integration requires your Loops API Key for authentication.

Getting Started

1

Open the Webhook Section

In your Dodo Payments dashboard, navigate to Webhooks → + Add Endpoint and expand the integrations dropdown.
Add Endpoint and integrations dropdown
2

Select Loops

Choose the Loops integration card.
3

Enter API Key

Provide your Loops API Key in the configuration.
4

Configure Transformation

Edit the transformation code to format emails for Loops’ API.
5

Test & Create

Test with sample payloads and click Create to activate the email sending.
6

Done!

🎉 Payment events will now automatically trigger transactional emails via Loops.

Transformation Code Examples

Payment Confirmation Email

payment_confirmation.js
function handler(webhook) {
  if (webhook.eventType === "payment.succeeded") {
    const p = webhook.payload.data;
    webhook.url = "https://api.loops.so/v1/events/send";
    webhook.payload = {
      eventName: "payment_confirmation",
      email: p.customer.email,
      properties: {
        customer_name: p.customer.name,
        payment_id: p.payment_id,
        amount: p.total_amount,
        currency: p.currency || "USD",
        payment_method: p.payment_method || "unknown",
        payment_date: new Date(webhook.payload.timestamp).toLocaleDateString()
      }
    };
  }
  return webhook;
}

Subscription Welcome Email

subscription_welcome.js
function handler(webhook) {
  if (webhook.eventType === "subscription.active") {
    const s = webhook.payload.data;
    webhook.url = "https://api.loops.so/v1/events/send";
    webhook.payload = {
      eventName: "subscription_welcome",
      email: s.customer.email,
      properties: {
        customer_name: s.customer.name,
        subscription_id: s.subscription_id,
        product_id: s.product_id,
        amount: s.recurring_pre_tax_amount,
        frequency: s.payment_frequency_interval,
        next_billing: s.next_billing_date
      }
    };
  }
  return webhook;
}

Payment Failure Notification

payment_failure.js
function handler(webhook) {
  if (webhook.eventType === "payment.failed") {
    const p = webhook.payload.data;
    webhook.url = "https://api.loops.so/v1/events/send";
    webhook.payload = {
      eventName: "payment_failed",
      email: p.customer.email,
      properties: {
        customer_name: p.customer.name,
        payment_id: p.payment_id,
        amount: p.total_amount,
        error_message: p.error_message || "Payment processing failed",
        retry_link: `https://yourdomain.com/retry-payment/${p.payment_id}`
      }
    };
  }
  return webhook;
}

Tips

  • Use descriptive event names for better email template organization
  • Include relevant customer properties for personalization
  • Set up email templates in Loops dashboard for each event
  • Use consistent property naming across events
  • Test email delivery before going live

Troubleshooting