Churn analysis for Stripe subscriptions
Churn is the silent killer of subscription businesses. Understanding why customers cancel is crucial for reducing churn and growing your business.
If you're using Stripe's Customer portal, you can collect cancellation reasons from churning customers. The following options are available:
- It’s too expensive
- I found an alternative
- I no longer need it
- Customer service was less than expected
- Ease of use was less than expected
- Quality was less than expected
- Other reason
Let's explore three methods for analyzing churn data from Stripe: the API, Sigma, and our product, DunningBear.
Using the Stripe API
The Stripe API offers a straightforward way to fetch and analyze churn data. You do this by fetching the canceled Stripe subscriptions and grouping them by their cancellation reason (referred to as feedback
in the API). Here's a Python script that does just that:
import stripe
# SET YOUR STRIPE SECRET KEY
stripe.api_key = 'sk_live_...'
def fetch_canceled_subscriptions_cancellation_reasons():
# Possible categories
categories = [
"customer_service",
"low_quality",
"missing_features",
"unspecified",
"switched_service",
"too_complex",
"too_expensive",
"unused",
]
categories_count = {category: 0 for category in categories}
# Fetch only canceled subscriptions from Stripe
subscriptions = stripe.Subscription.list(status='canceled', limit=100)
for sub in subscriptions.auto_paging_iter():
cancellation_details = sub.get("cancellation_details", {})
reason = cancellation_details.get("feedback")
if reason in categories_count:
categories_count[reason] += 1
else:
categories_count["unspecified"] += 1
print("Cancellation Reason Totals:")
for category, count in categories_count.items():
print(f"{category}: {count}")
if __name__ == "__main__":
fetch_canceled_subscriptions_cancellation_reasons()
This script fetches all canceled subscriptions, extracts relevant data, and provides a summary of cancellation reasons and common themes in cancellation comments.
You could also listen to the subscription.updated
webhook to process those events in real-time.
Using the Stripe Sigma
Stripe Sigma offers SQL-based analysis for those who prefer working with structured queries. Here’s a query that replicates the code above:
SELECT
CASE
WHEN subscriptions.cancellation_details['feedback'] = 'customer_service'
THEN 'customer_service'
WHEN subscriptions.cancellation_details['feedback'] = 'low_quality'
THEN 'low_quality'
WHEN subscriptions.cancellation_details['feedback'] = 'missing_features'
THEN 'missing_features'
WHEN subscriptions.cancellation_details['feedback'] = 'switched_service'
THEN 'switched_service'
WHEN subscriptions.cancellation_details['feedback'] = 'too_complex'
THEN 'too_complex'
WHEN subscriptions.cancellation_details['feedback'] = 'too_expensive'
THEN 'too_expensive'
WHEN subscriptions.cancellation_details['feedback'] = 'unused'
THEN 'unused'
ELSE 'unspecified'
END AS cancellation_reason,
COUNT(*) AS count
FROM subscriptions
INNER JOIN customers
ON customers.id = subscriptions.customer_id
WHERE subscriptions.status = 'canceled'
GROUP BY 1
ORDER BY 1;
This query provides a comprehensive breakdown of cancellations by reason.
Using DunningBear
While the API and Sigma methods are powerful, they require technical expertise and ongoing maintenance. DunningBear simplifies this process:
- Automatic data collection and processing
- Real-time dashboard updates
- Pre-built reports and visualizations
- Trend analysis and predictive insights
DunningBear does the heavy lifting, allowing you to focus on reducing churn rather than analyzing it.