Larz › Dunning in Python

Stop losing revenue to failed renewals

Failed subscription payments are money most indie apps just… lose. Dunning is the recovery process — and in Larz it's one scheduled call.

pip install larz
@app.schedule("0 9 * * *")           # daily at 9am
def dun():
    app.money.run_dunning(grace_days=7,
        on_notify=lambda subject, sku, attempt: send_reminder(subject, attempt))

@app.money.on_payment_failed
def dropped(subject, sku):
    ...                              # finally lost after the grace period

QuickstartGitHubAI course

How recovery works

When a subscription's term lapses without a renewal, Larz starts dunning it: it notifies the customer on a schedule (day 0/3/7 by default), keeps access alive through a grace period, and only revokes — firing on_payment_failed — if it never recovers. A successful renewal clears the dunning state automatically.

FAQ

What is dunning?

Dunning is the process of recovering failed recurring payments — retrying the charge and reminding the customer before you cut off access.

What happens after the grace period?

If a lapsed subscription never renews within grace_days, Larz revokes access and fires the on_payment_failed hook so you can act on it.