Guides / SaaS
Most founders check their Stripe dashboard reactively. LogIt flips this — you get notified proactively, the moment revenue moves.
case "customer.subscription.created": {
const sub = event.data.object;
const price = sub.items.data[0]?.price;
const amount = ((price?.unit_amount ?? 0) / 100).toFixed(2);
const interval = price?.recurring?.interval ?? "month";
await logit.now("revenue", {
event: "New subscription 🎉",
description: `${customerEmail} — $${amount}/${interval}`,
icon: "🎉",
notify: true,
tags: {
plan: price?.nickname ?? "unknown",
interval,
mrr: amount,
},
metadata: {
subscriptionId: sub.id,
customerId: String(sub.customer),
email: customerEmail,
amount: price?.unit_amount,
},
});
break;
}
case "customer.subscription.updated": {
const prev = event.data.previous_attributes as { items?: unknown };
if (!prev.items) break; // not a plan change
await logit.now("revenue", {
event: "Plan upgraded ⬆️",
description: `${customerEmail}: ${oldPlan} → ${newPlan}`,
icon: "⬆️",
notify: true,
tags: { from: oldPlan, to: newPlan },
metadata: { subscriptionId: sub.id, email: customerEmail },
});
break;
}
Track this from your billing sync job:
if (currentMrr >= milestone && previousMrr < milestone) {
await logit.now("milestones", {
event: `MRR milestone: $${milestone.toLocaleString()}`,
description: `Current MRR: $${currentMrr.toLocaleString()}`,
icon: "🏆",
notify: true,
tags: { milestone: String(milestone) },
metadata: { currentMrr, previousMrr },
});
}
Try LogIt free
7-day trial. No credit card required.