Menu

Three retries, then stop: the dunning rules I can defend in a code review
📰

Three retries, then stop: the dunning rules I can defend in a code review

DEV Community: backend·Aurum Revenue·12 days ago
#T4OQDyDC
#devtobackend#devto#dev#retry#schedule
Long article (617 words) — no AI summary yet.
Reading 0:00
15s threshold

A retry loop that sends four reminders about a €4 invoice costs more than the invoice. I kept seeing the same shape in failed-payment handling: one schedule applied to every failure, because writing down the exceptions felt like more work than letting the schedule run.

So I wrote the exceptions down.

The engine is one Python file. It reads a JSON event on stdin and writes one JSON decision on stdout. No network calls, no database, no secrets in the output. The whole policy fits on a screen, which is the point.

Timing is the least interesting part

The obvious dunning question is "when do we retry?" The more expensive question is "should we retry at all?"

Three ordinary declines get three increasing gaps:

first failure: retry in 24 hours, friendly reminder

second: retry in 72 hours, firmer reminder

third: retry in 168 hours, final notice, and escalate to a person

That is a schedule.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.