Only send a Stripe final notice when no retry is left
When a subscription payment fails, Stripe sends invoice.payment_failed and, if your retry settings allow, tries again later. It's tempting to send a "final notice" email once attempt_count reaches 3 or 4. But the number of retries depends on your Dashboard settings, which can change, so a hard-coded count can scare a customer while a retry is still due.
Check the invoice instead:
const inv = event.data.object;
const noRetryLeft = !inv.next_payment_attempt;
If next_payment_attempt holds a timestamp, Stripe will try again, so send a friendly notice with the hosted invoice link. Use "final notice" only when it's empty.
The Failed Payment Dunning (for Stripe), n8n pack (US$34) works this way. In our tests, a third failed attempt with a retry pending did not get a final notice.