Markov Chains for Recurring Payment Recovery: Forecasting When History Matters

<a href="https://www.freepik.com/free-ai-image/3d-rendering-blockchain-technology_196468746.htm#fromView=search&page=1&position=4&uuid=9b851e65-3f85-4caf-9920-18e367089af5&query=chains+and+graph">Image by freepik</a>

For subscription businesses — SaaS platforms, streaming services, membership programs — recurring revenue is the heartbeat of operations. Yet one persistent problem interrupts this rhythm: payment failures.

Cards expire. Bank balances dip below the charge amount. Occasionally, a payment attempt is declined for reasons that are hard to pin down. Whatever the cause, failed payments create friction in the customer relationship and unpredictability in revenue.

But predicting whether a failed payment will eventually recover isn’t straightforward. The probability of success doesn’t just depend on the most recent attempt — it depends on patterns. For example, someone who pays after a failure behaves differently from someone who fails twice in a row. That’s where Markov chains provide a structured way to model and forecast outcomes.

What Exactly Is a Markov Chain?

A Markov chain is a type of mathematical model used to describe systems that move between states over time, with each transition governed by probability.

Key ingredients:

  • States: The possible conditions a system can be in (e.g., “Paid” or “Failed”).

  • Transitions: The probabilities of moving from one state to another.

  • Memoryless property: In the simplest case (a first-order chain), only the present matters for predicting the future. Past states are ignored.

To extend this, higher-order chains allow recent history to influence the future. A second-order Markov chain, for example, looks at the last two outcomes, not just the last one.

A quick historical note: The idea comes from Russian mathematician Andrey Markov, who in 1906 challenged the prevailing assumption in probability theory that events had to be independent. He showed that you could still make rigorous predictions even when outcomes were linked in sequence. That insight — that dependence can be structured mathematically — became foundational in fields as diverse as finance, genetics, queueing systems, natural language processing, and modern AI.

Why Payment Recovery Needs a Second-Order Chain

If you only considered the most recent billing attempt, you’d miss important dynamics:

  • A customer who paid after a previous failure is more resilient and may return to consistent payment.

  • A customer who failed after a previous failure is in a higher-risk trajectory and harder to recover.

That’s why modeling payments as a second-order Markov chain — where the next outcome depends on the last two — captures the momentum effect in customer payment behavior.

Building the Example: Payment Histories as States

We define four states based on the last two payment outcomes:

  1. PP – Paid, then Paid

  2. PF – Paid, then Failed

  3. FP – Failed, then Paid

  4. FF – Failed, then Failed

Each state summarizes recent history. The customer is “in” one of these states before the next billing attempt.

Transition Matrix from Historical Data

By analyzing real billing records, we can estimate the transition probabilities — how likely each state leads to the next:

Current State     PP Next     PF Next     FP Next     FF Next
PP 0.95 0.05 0.00 0.00
PF 0.00 0.00 0.70 0.30
FP 0.85 0.15 0.00 0.00
FF 0.00 0.00 0.40 0.60

Interpretation:

  • If a customer has paid twice in a row (PP), they’re very stable: 95% chance of paying again.

  • If they fail right after a successful payment (PF), they have a 70% chance of recovering on the next attempt.

  • Two consecutive failures (FF) are risky — they’re more likely to stay in failure than to bounce back.

Visualizing the Dynamics


This diagram shows the reinforcing loops — stability in PP, recovery cycles through FP, and persistence in FF.

The Mathematical Model

We express the transitions in matrix form:

P=[0.950.0500000.700.300.850.1500000.400.60]P = \begin{bmatrix} 0.95 & 0.05 & 0 & 0 \\ 0 & 0 & 0.70 & 0.30 \\ 0.85 & 0.15 & 0 & 0 \\ 0 & 0 & 0.40 & 0.60 \end{bmatrix}

Suppose the initial distribution of customers across states is:

π0=[0.60,0.10,0.20,0.10]\pi_0 = [0.60, 0.10, 0.20, 0.10]

That means:

  • 60% are currently in PP,

  • 10% in PF,

  • 20% in FP,

  • 10% in FF.

To predict the distribution after tt billing cycles:

πt=π0Pt\pi_t = \pi_0 \cdot P^t

This tells us how customer states evolve over time.

Python Simulation

import numpy as np
# States: PP, PF, FP, FF
P = np.array([
    [0.95, 0.05, 0.00, 0.00],
    [0.00, 0.00, 0.70, 0.30],
    [0.85, 0.15, 0.00, 0.00],
    [0.00, 0.00, 0.40, 0.60]
])

pi = np.array([0.60, 0.10, 0.20, 0.10])  # initial distribution

# Define recovery probabilities for each state
recover_probs = np.array([0.95, 0.70, 0.85, 0.40])

for t in range(12):  # simulate 12 billing cycles
    pr_paid_next = np.dot(pi, recover_probs)
    print(f"Month {t+1}: Pr(Paid next) = {pr_paid_next:.2%}, state distribution = {pi}")
    pi = pi @ P

This code projects both the chance of successful collection in the next cycle and the distribution of customers across states over time.

Output:

Month 1: Pr(Paid next) = 85.00%, state distribution = [0.6 0.1 0.2 0.1]
Month 2: Pr(Paid next) = 87.45%, state distribution = [0.74 0.06 0.11 0.09]
Month 3: Pr(Paid next) = 88.92%, state distribution = [0.7965 0.0535 0.078  0.072 ]
Month 4: Pr(Paid next) = 89.79%, state distribution = [0.822975 0.051525 0.06625  0.05925 ]
Month 5: Pr(Paid next) = 90.32%, state distribution = [0.83813875 0.05108625 0.0597675  0.0510075 ]
Month 6: Pr(Paid next) = 90.64%, state distribution = [0.84703419 0.05087206 0.05616338 0.04593037]
Month 7: Pr(Paid next) = 90.84%, state distribution = [0.85242135 0.05077622 0.05398259 0.04281984]
Month 8: Pr(Paid next) = 90.95%, state distribution = [0.85568548 0.05071846 0.05267129 0.04092477]
Month 9: Pr(Paid next) = 91.03%, state distribution = [0.85767181 0.05068497 0.05187283 0.0397704 ]
Month 10: Pr(Paid next) = 91.07%, state distribution = [0.85888012 0.05066451 0.05138764 0.03906773]
Month 11: Pr(Paid next) = 91.10%, state distribution = [0.8596156  0.05065215 0.05109225 0.03863999]
Month 12: Pr(Paid next) = 91.11%, state distribution = [0.86006324 0.05064462 0.0509125  0.03837964]

Insights for Subscription Businesses

  • Target recovery actions: Customers in PF (Paid→Failed) are good candidates for light-touch reminders, since their recovery odds are relatively high. By contrast, FF customers may need stronger interventions (e.g., account pause warnings).

  • Cash flow forecasting: By multiplying recovery probability by active subscribers and ARPU, you can forecast expected collections with more realism than using a flat rate.

  • Scenario testing: Small improvements compound. For example, if you can raise FF recovery from 40% to 50% through smarter dunning, the long-term lift in revenue can be significant.

Key Takeaways

  • Markov chains let you turn payment history into predictive insight.

  • Second-order models capture momentum effects — not just what happened last time, but what’s been happening recently.

  • With the right data, you can move beyond averages and start forecasting with state-dependent probabilities.

This approach transforms recurring payment recovery from reactive problem-solving into proactive cash flow management.

References

  1. Introduction to Markov Chains – SpringerLink

  2. How Markov’s Little Idea Transformed Statistics – Jeff Rosenthal, University of Toronto

  3. Markov Chains Lecture Notes – University of Cambridge


Top Posts

Signs of a Toxic Workplace and Its Impact on Organizations

Linked List Part 1: Overview

Understanding Deterministic Methods in Operations Research