결제 이벤트가 발생할 때 자동으로 거래 이메일을 전송하고 고객 커뮤니케이션을 관리합니다. 루프의 이메일 인프라를 통해 결제 확인, 구독 업데이트 및 중요한 알림을 전달합니다.
이 통합은 인증을 위해 Loops API 키가 필요합니다.
시작하기
Open the Webhook Section
Dodo Payments 대시보드에서 Webhooks → + Add Endpoint로 이동하여 통합 드롭다운을 확장합니다. Select Loops
Loops 통합 카드를 선택하세요.
Enter API Key
구성에서 Loops API 키를 입력하세요.
Configure Transformation
변환 코드를 편집하여 Loops API에 맞게 이메일을 포맷하세요.
Test & Create
샘플 페이로드로 테스트한 후 Create를 클릭하여 이메일 전송을 활성화하세요.
Done!
🎉 결제 이벤트가 이제 Loops를 통해 자동으로 거래 이메일을 트리거합니다.
변환 코드 예제
결제 확인 이메일
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;
}
구독 환영 이메일
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;
}
결제 실패 알림
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;
}
- 더 나은 이메일 템플릿 구성을 위해 설명적인 이벤트 이름을 사용하세요
- 개인화를 위해 관련 고객 속성을 포함하세요
- 각 이벤트에 대해 Loops 대시보드에서 이메일 템플릿을 설정하세요
- 이벤트 전반에 걸쳐 일관된 속성 이름을 사용하세요
- 라이브로 전환하기 전에 이메일 전송을 테스트하세요
문제 해결
- API 키가 정확하고 활성 상태인지 확인하세요
- 이벤트 이름이 Loops 템플릿과 일치하는지 확인하세요
- 수신자 이메일 주소가 유효한지 확인하세요
- Loops 전송 제한 및 할당량을 검토하세요