SaaS Stripe Analytics (Production-Ready)
🎯 When to Use This Skill
Primary triggers:
- - MRR/churn tracking ("Stripe metrics", "business dashboard")
- Customer analysis ("top customers", "LTV ranking")
- Revenue health ("forecast", "payment recovery")
- Alerts ("churn risks", "at-risk customers")
Input Schema (JSON):
CODEBLOCK0
Default: 30 days, plan segments, 3-month forecast, top 10 customers.
📤 Output Format (Always)
CODEBLOCK1
🛠 Setup & Environment
Required
STRIPE_READ_KEY=sk_read_xxx...
Exact Stripe Setup:
- 1. Dashboard → Developers → API Keys → Restricted Key
- Scopes:
read: Customer | read: Subscription | INLINECODE2 - Scopes:
read: Payment Intent (read-only, for failed payment recovery only) - ✅ No write/refund/charge scopes
Optional
CODEBLOCK3
⚡ Performance & Limits
- - Execution: 2.1s avg (5 parallel calls)
- Pagination: Auto (1000+ customers)
- Rate Limits: Handled (429 → retry logic)
- Data Retention: 365 days max
- Output Size: ~4KB compressed
🔗 Example Workflows
1. Daily Dashboard
CODEBLOCK4
2. Churn Investigation
CODEBLOCK5
3. Geo Expansion
CODEBLOCK6
🧪 Test Cases (Verified)
| Test | Input | Expected |
|---|
| Happy Path | INLINECODE4 | INLINECODE5 |
| No Key |
{} |
{"error_type": "auth_error"} |
| Invalid Days |
{"days_back": 500} |
{"days_back": 365} (clamped) |
| Rate Limit | 429 |
{"error_type": "rate_limit"} |
📊 Metrics Explained
| Metric | Formula | Good (>80th %) |
|---|
| MRR Growth | (Current - Prev) / Prev | +8% MoM |
| Revenue Churn |
Cancelled MRR / Starting MRR | <5% |
| NRR | (Ending MRR + Expansion) / Starting | >100% |
| LTV/CAC | LTV ÷ CAC | >3x |
🔒 Security (ClawHub Verified)
CODEBLOCK7
📈 Composability
CODEBLOCK8
🚀 OpenClaw Integration
Slash Commands:
CODEBLOCK9
Voice Triggers:
- - "Hey, Stripe numbers?"
- "Business dashboard"
- "Revenue this month"
📝 Troubleshooting
| Error | Fix |
|---|
| INLINECODE11 | Check restricted key scopes |
| INLINECODE12 |
Wait 60s or upgrade plan |
|
network_error | Check internet + Stripe status |
| Empty data | No subs in time range? Try
days_back: 90 |
🎯 Founder Value Prop
Saves 2h/week manual reporting → Focus on growth
- - Instant VC-level dashboards
- Churn prevention alerts
- Expansion opportunities
- Pricing experiment ROI
- Automated forecasting
"Stripe analysis" → Your complete SaaS command center.
Tags: saas,stripe,analytics,mrr,churn,lTV,customer,forecast | v1.0.3
SaaS Stripe 分析(生产就绪)
🎯 何时使用此技能
主要触发场景:
- - MRR/流失追踪(Stripe 指标、业务仪表盘)
- 客户分析(头部客户、LTV 排名)
- 收入健康度(预测、支付恢复)
- 告警(流失风险、高危客户)
输入模式(JSON):
{
days_back: 90, // 7-365 天
segment_by: geo, // plan|geo|industry
forecast_months: 6, // 1-12 个月
customer_limit: 15 // 1-50
}
默认值:30 天、按方案分段、3 个月预测、前 10 名客户。
📤 输出格式(固定)
SUCCESS:
{
status: success,
data: {
mrr: {current: 12450, growth_pct: 11},
churn: {revenuepct: 3.2, atrisk: 7},
segments: [{name: US, arpu: 89}],
forecast: [13500, 14600, 15800],
insights: [US ARPU 2x EU],
action_items: [{priority: high, impact: revenue}]
},
metadata: {executiontimems: 2100, api_calls: 5}
}
ERROR:
{
status: error,
errortype: autherror|ratelimit|networkerror,
message: Human-readable fix
}
🛠 设置与环境
必需项
STRIPEREADKEY=skreadxxx...
精确 Stripe 设置:
- 1. 仪表盘 → 开发者 → API 密钥 → 受限密钥
- 权限范围:read: Customer | read: Subscription | read: Invoice
- 权限范围:read: Payment Intent(仅读取,仅用于失败支付恢复)
- ✅ 无写入/退款/扣款权限
可选项
STRIPECACHETTL=3600 # 秒(默认:1 小时)
STRIPE_TIMEOUT=8000 # 毫秒(默认:8 秒)
⚡ 性能与限制
- - 执行时间:平均 2.1 秒(5 个并行调用)
- 分页:自动(1000+ 客户)
- 速率限制:已处理(429 → 重试逻辑)
- 数据保留:最长 365 天
- 输出大小:约 4KB 压缩
🔗 示例工作流
1. 每日仪表盘
用户:Stripe 指标 + 预测
→ 2 秒内返回完整 MRR/流失/客户/预测
2. 流失调查
流失风险 + 头部客户
→ 风险客户列表 + LTV 排名 + 可恢复金额
3. 地域扩展
按国家查看收入
→ 美国:66% | 欧盟:22% | 本地化定价?
🧪 测试用例(已验证)
| 测试 | 输入 | 预期结果 |
|---|
| 正常路径 | {daysback: 30} | {status: success, mrr: {...}} |
| 无密钥 |
{} | {errortype: auth_error} |
| 无效天数 | {days
back: 500} | {daysback: 365}(自动限制) |
| 速率限制 | 429 | {error
type: ratelimit} |
📊 指标说明
| 指标 | 计算公式 | 优秀(>80 百分位) |
|---|
| MRR 增长率 | (当前 - 上期) / 上期 | 月环比 +8% |
| 收入流失率 |
取消 MRR / 期初 MRR | <5% |
| NRR | (期末 MRR + 扩展收入) / 期初 | >100% |
| LTV/CAC | LTV ÷ CAC | >3 倍 |
🔒 安全性(ClawHub 已验证)
✅ 只读密钥(仅限 read:customers/subscriptions/invoices/payment_intents)
✅ 无数据存储/持久化
✅ 无密钥记录/输出
✅ 分页防止 DoS 攻击
✅ 每次调用 8 秒超时
✅ 错误信息安全(不含密钥)
📈 可组合性
saasstripeanalyticsfinal → churnpredictor → winbackemailgenerator
stripetopcustomers → personalizedupsell → sendcustom_email
georevenuebreakdown → marketexpansionplan → generatelocalizedlanding
🚀 OpenClaw 集成
斜杠命令:
/stripe-metrics # 默认 30 天仪表盘
/stripe-churn # 流失 + 恢复重点
/stripe-forecast # MRR 预测
/stripe-segments # 方案/地域/行业细分
语音触发:
📝 故障排除
| 错误 | 修复方法 |
|---|
| autherror | 检查受限密钥权限范围 |
| ratelimit |
等待 60 秒或升级套餐 |
| network_error | 检查网络 + Stripe 状态 |
| 数据为空 | 时间范围内无订阅?尝试 days_back: 90 |
🎯 创始人价值主张
每周节省 2 小时手动报告 → 专注于增长
- - 即时风投级仪表盘
- 流失预防告警
- 扩展机会
- 定价实验 ROI
- 自动化预测
Stripe 分析 → 您的完整 SaaS 指挥中心。
标签:saas,stripe,analytics,mrr,churn,lTV,customer,forecast | v1.0.3