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
Open the Webhook Section
In your Dodo Payments dashboard, navigate to Webhooks → + Add Endpoint and expand the integrations dropdown.
Select Loops
Choose the Loops integration card.
Enter API Key
Provide your Loops API Key in the configuration.
Configure Transformation
Edit the transformation code to format emails for Loops’ API.
Test & Create
Test with sample payloads and click Create to activate the email sending.
Done!
🎉 Payment events will now automatically trigger transactional emails via Loops.
Payment Confirmation Email
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 / 100 ). toFixed ( 2 ),
currency: p . currency || "USD" ,
payment_method: p . payment_method || "unknown" ,
payment_date: new Date ( webhook . payload . timestamp ). toLocaleDateString ()
}
};
}
return webhook ;
}
See all 19 lines
Subscription Welcome Email
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 / 100 ). toFixed ( 2 ),
frequency: s . payment_frequency_interval ,
next_billing: s . next_billing_date
}
};
}
return webhook ;
}
See all 19 lines
Payment Failure Notification
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 / 100 ). toFixed ( 2 ),
error_message: p . error_message || "Payment processing failed" ,
retry_link: `https://yourdomain.com/retry-payment/ ${ p . payment_id } `
}
};
}
return webhook ;
}
See all 18 lines
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
Verify API Key is correct and active
Check that event names match your Loops templates
Ensure recipient email addresses are valid
Review Loops sending limits and quotas