Guides / Payments
A single failed payment is noise — cards decline for dozens of reasons. But five failures in ten minutes is a signal: your payment processor may be down, your checkout is broken, or a fraud wave is hitting.
Smart Actions evaluates counts, not individual events. You set the rule once; it fires only when the pattern matters.
// In your Stripe webhook handler
import { logit } from "@/lib/logit";
if (event.type === "payment_intent.payment_failed") {
const intent = event.data.object;
await logit.now("payments", {
event: "Payment failed",
description: intent.last_payment_error?.message ?? "Unknown failure",
icon: "❌",
notify: false, // Smart Action handles bulk alerting
tags: {
declineCode: intent.last_payment_error?.decline_code ?? "none",
currency: intent.currency,
},
metadata: {
intentId: intent.id,
amount: intent.amount,
customerId: intent.customer,
},
});
}
| Field | Value |
|---|---|
| Name | Payment failure spike |
| Channel | payments |
| Event name | Payment failed |
| Threshold | 5 |
| Window | 10 minutes |
| Cooldown | 1 hour |
| Action | Push notification |
| Push title | ❌ Payment failure spike |
| Push body | 5+ failures in 10 minutes — check Stripe |
| Traffic level | Recommended threshold | Recommended window |
|---|---|---|
| < 100 payments/day | 3 failures | 15 minutes |
| 100–1,000 payments/day | 5 failures | 10 minutes |
| > 1,000 payments/day | 10 failures | 5 minutes |
Start conservative. You can lower the threshold once you know your normal failure baseline.
decline_code: card_declined vs. do_not_honor — they have different remediation paths.Try LogIt free
7-day trial. No credit card required.