Guides / Payments

Track Your Dunning Campaign Results

4 min read·Payments

What Is Dunning?

Dunning is the process of recovering failed subscription payments: retrying the charge, sending reminder emails, and eventually cancelling if payment can't be recovered. Logging each step gives you a real-time funnel.

Events to Log

ts
// 1. Initial payment failure
await logit.now("dunning", {
  event: "Dunning started",
  description: `${customerEmail} — payment failed, dunning initiated`,
  icon: "⚠️",
  notify: false,
  tags: { step: "start", plan: customer.plan },
  metadata: { customerId, email: customerEmail, amount, subscriptionId },
});

// 2. Dunning email sent
await logit.now("dunning", {
  event: "Dunning email sent",
  description: `Reminder ${attemptNumber} sent to ${customerEmail}`,
  icon: "✉️",
  notify: false,
  tags: { step: "email", attempt: attemptNumber.toString() },
  metadata: { customerId, email: customerEmail, attemptNumber },
});

// 3. Retry succeeded — recovery
await logit.now("dunning", {
  event: "Payment recovered",
  description: `${customerEmail} paid after ${daysSinceFailure} days`,
  icon: "✅",
  notify: true,
  tags: { step: "recovered", plan: customer.plan },
  metadata: { customerId, email: customerEmail, amount, daysSinceFailure },
});

// 4. Subscription cancelled after failed dunning
await logit.now("dunning", {
  event: "Dunning failed — subscription cancelled",
  description: `${customerEmail} could not be recovered`,
  icon: "❌",
  notify: true,
  tags: { step: "cancelled", plan: customer.plan },
  metadata: { customerId, email: customerEmail, subscriptionId },
});

Smart Action: Alert on High Cancellation Rate

FieldValue
NameDunning failure cluster
Channeldunning
Event nameDunning failed — subscription cancelled
Threshold3
Window24 hours
Cooldown24 hours
ActionPush notification + Slack webhook

Tips

  • Log the step number in tags (attempt: "1", "2", "3") so you can see which retry email drives the most recoveries.
  • Log daysSinceFailure in metadata to understand how long your dunning window should be.
  • The dunning channel gives you a complete funnel: start → emails → recovered or cancelled.

Try LogIt free

7-day trial. No credit card required.

Start free