LostChurn Docs
Recovery

Failure Prediction

Predict payment failures before they happen with card expiration monitoring, anomaly detection, and proactive customer outreach in LostChurn.

Failure prediction helps you anticipate payment failures before they happen. Instead of reacting to failed payments, LostChurn can proactively reach out to at-risk customers and optimize retry timing after a failure occurs.

Advanced prediction features including custom ML models are available on Revenue Command and Enterprise tiers.

Overview

LostChurn's prediction capabilities operate in two modes:

  1. Pre-failure prediction -- Identifies payments likely to fail before the charge is attempted, enabling proactive outreach
  2. Post-failure scoring -- Scores each retry attempt to optimize timing, channel, and routing for maximum recovery

Card Expiration Prediction

The simplest and most reliable prediction: cards that are about to expire will almost certainly fail on the next billing cycle.

How It Works

LostChurn monitors the expiration dates on stored payment methods. When a card is within a configurable window of expiration (default: 30 days), the system flags the associated subscriptions and can trigger pre-dunning campaigns.

Prediction Timeline

Days Before ExpiryAction
60 daysFlag subscription as at-risk (visible in dashboard)
30 daysTrigger pre-dunning campaign (if configured)
14 daysSend urgent card update reminder
7 daysFinal reminder with subscription cancellation warning
0 daysCard expires; next charge will fail

Card Update Flow

When a customer receives a pre-dunning message about an expiring card:

  1. They click the payment update link in the message
  2. The self-service portal shows their current card details (masked) and the expiration date
  3. They enter new card information
  4. LostChurn updates the payment method with the PSP
  5. The subscription continues uninterrupted -- no failed payment ever occurs

Merchants who enable card expiration prediction typically see a 15-25% reduction in involuntary churn from expired cards, because customers update their payment method before the charge fails.

Card Expiry Alerts

For detailed configuration of expiry-based alerts, see Card Expiry Alerts.

Payment Pattern Anomaly Detection

Beyond simple card expiration, LostChurn analyzes payment patterns to detect anomalies that predict failures. The detect_payment_anomalies reducer scans a merchant's recent payment events across two 7-day windows and inserts failure_prediction rows when patterns are detected.

Four Anomaly Patterns

LostChurn's anomaly engine (anomaly-v1 model) monitors four distinct patterns:

PatternDetection LogicProbability RangeRecommended Action
Decline rate spike>20% increase in declines period-over-period (current vs. previous 7-day window)0.50 -- 1.00 (scales with spike magnitude)pre_dunning
Card expiration wave3+ customer cards expiring in the same monthFixed at 0.70card_update_reminder
High-value terminal failureTerminal decline on a transaction over $500Fixed at 0.85pre_dunning
Repeated customer failures3+ failures from the same customer within 7 days0.60 -- 0.95 (scales with failure count)pre_dunning

Predictions are deduplicated -- if an unexpired prediction already exists for a customer with the same model version, a new one is not created. All predictions expire after 7 days and are garbage-collected by the clear_expired_predictions reducer.

Monitored Signals

SignalWhat It DetectsRisk Indicator
Consecutive soft declinesCustomer's bank is intermittently decliningEscalating failure likelihood
Sudden plan downgradeCustomer reduced their subscription tierPotential payment sensitivity
Billing amount increaseSubscription price increased (plan change, add-ons)Higher decline risk at new amount
Geographic mismatchCard issuer country differs from customer's current locationCross-border decline risk
Payment method ageCard has been on file for 3+ years without updateApproaching natural expiration
Historical failure rateCustomer has failed payments in the pastRepeat failure pattern

Anomaly Scoring

Each prediction receives a failure_probability score from 0.0 to 1.0 (displayed as 0--100 in the dashboard):

Score RangeRisk LevelRecommended Action
0-20LowNo action needed
21-50ModerateMonitor; consider pre-dunning if approaching billing date
51-80HighSend proactive outreach to update payment method
81-100CriticalImmediate outreach; consider pausing subscription

View anomaly scores in the Subscriptions list. Sort by risk score to focus on the most vulnerable subscriptions.

Prediction Data Model

Each failure_prediction row stores:

FieldDescription
failure_probabilityScore from 0.0 to 1.0
risk_factorsJSON array of contributing factors (e.g., ["decline_rate_spike", "increase_35pct"])
recommended_actionEither pre_dunning or card_update_reminder
model_versionCurrently anomaly-v1 for pattern detection, rule-based-v0.1 for card expiry
predicted_at / expires_atTimestamp range (7-day TTL)

Alert Configuration

To enable anomaly detection alerts:

  1. Navigate to Settings > Recovery > Failure Prediction
  2. Toggle Anomaly Detection to on
  3. Set the high-value threshold (default: $500) for terminal decline monitoring
  4. Configure the spike sensitivity -- the minimum percentage increase to trigger a decline rate spike alert (default: 20%)
  5. Set the repeated failure threshold -- minimum failures per customer in 7 days (default: 3)
  6. Choose whether anomaly predictions should auto-enroll customers in pre-dunning campaigns

Proactive Outreach Triggers

When the prediction engine identifies an at-risk subscription, it can automatically trigger pre-failure outreach.

Pre-Dunning Campaigns

Pre-dunning campaigns use the Pre-Dunning trigger type in the campaign builder. They fire before a payment fails:

  • Trigger: Prediction score exceeds threshold (configurable, default: 60)
  • Message tone: Helpful and proactive, not urgent
  • Goal: Get the customer to update their payment method before the next charge
  • Stop condition: Customer updates their payment method

Example Pre-Dunning Email

Subject: Quick heads-up about your {{merchant_name}} subscription

Hi {{customer_name}},

We noticed your payment method on file may need updating before
your next billing date on {{next_billing_date}}.

To avoid any interruption to your subscription, please take a
moment to verify your payment details:

[Update Payment Method]({{update_url}})

This only takes a minute and ensures your service continues
without interruption.

Thanks,
The {{merchant_name}} Team

Trigger Configuration

Navigate to Settings > Recovery > Failure Prediction to configure:

  • Prediction threshold -- Minimum anomaly score to trigger pre-dunning (default: 60)
  • Lookahead window -- How far before the billing date to evaluate predictions (default: 7 days)
  • Cooldown period -- Minimum days between pre-dunning campaigns for the same customer (default: 30 days)
  • Eligible triggers -- Which prediction signals can trigger outreach (card expiry, anomaly score, or both)

ML Retry Scoring

After a payment fails, the prediction engine shifts to optimizing recovery. The score_retry_ml procedure evaluates each potential retry attempt and returns a confidence score that influences when, how, and where the retry happens.

Scoring Model

LostChurn uses a two-tier scoring architecture:

  1. Rule-based scoring (rule-based-v0.2) -- The primary scoring path. Evaluates 7 features: decline category (35% weight), decline code (25%), attempt number (15%), time of day (10%), day of week (5%), transaction amount (5%), and customer lifetime value (5%).
  2. ONNX XGBoost inference (Phase 5.2, planned) -- An optional ML model that can replace rule-based scoring. Until the ONNX model is loaded, rule-based scoring is always used as the fallback.

The scoring procedure considers the merchant's timezone when calculating time-of-day and day-of-week features, and factors in the customer's 90-day failure history and lifetime value.

Confidence Scores

Each retry attempt receives a confidence score from 0.0 to 1.0 representing the probability of success:

Score RangeInterpretationAction
0.8 - 1.0Very likely to succeedRetry immediately
0.5 - 0.8Good chance of successRetry at optimal time
0.2 - 0.5UncertainRetry with caution; consider dunning
0.0 - 0.2Unlikely to succeedSkip retry; escalate to dunning

Each score also includes a confidence interval that widens with higher attempt numbers (reflecting increasing uncertainty), and a recommended delay in hours based on the decline code:

Decline CodeRecommended Delay
insufficient_funds, card_velocity_exceeded72 hours
processing_error, try_again_later12 hours
issuer_not_available6 hours
All other codes48 hours

How Scores Influence Recovery

The retry score affects multiple decisions in the recovery pipeline:

  1. Retry timing -- Higher scores justify faster retries; lower scores suggest waiting longer (via recommended_delay_hours)
  2. Cascade routing -- Scores can differ by PSP, influencing gateway cascading order
  3. Dunning escalation -- Low scores trigger earlier escalation to customer communication
  4. Channel selection -- Scores inform whether to use email, SMS, or voice outreach

Card Expiry Prediction Model

The predictFailure function evaluates card expiration proximity and recent failure history:

FactorProbability Contribution
Card already expired+0.60
Expiring within 30 days+0.40
Expiring within 60 days+0.20
3+ recent failures (90-day window)+0.25
1-2 recent failures+0.10
Base probability0.10

When probability exceeds 0.5, the recommended action is card_update_reminder. Between 0.3 and 0.5, the action is pre_dunning. Below 0.3, no action is taken.

Viewing Predictions in the Dashboard

Subscription Risk View

Navigate to Subscriptions > At Risk to see all subscriptions with elevated prediction scores:

  • Sort by risk score, next billing date, or subscription value
  • Filter by risk level (Low, Moderate, High, Critical)
  • Bulk-enroll high-risk subscriptions in pre-dunning campaigns

Retry Score History

In the Recovery Detail view for any payment, the Prediction tab shows:

  • The retry score for each attempt
  • Which factors contributed most to the score
  • How the prediction changed between attempts

What's Next

On this page