Stripe Revenue Intelligence — Daily Analytics for OpenClaw
SkillSkill
Daily, weekly & monthly Stripe revenue — multi-account, anomaly alerts, no dashboard needed.
About
name: Stripe Revenue Intelligence description: "Daily, weekly, and monthly Stripe revenue metrics for founders — net revenue, MRR, growth rate, per-account breakdown, and anomaly alerts. Runs via a self-contained Python script; no external packages required. Triggers: stripe revenue, stripe metrics, mrr, arr, revenue dashboard, stripe analytics, revenue tracking, daily revenue, stripe report, saas metrics" metadata: openclaw: homepage: https://github.com/PhantomWorksIO/clawhub-skills emoji: "💰" category: productivity price: 9 version: "1.0.0"
Stripe Revenue Intelligence 💰
Your revenue scoreboard — built for founders who ship.
Stop checking the Stripe dashboard manually. This skill pulls daily, weekly, and monthly revenue metrics from your Stripe account(s), compares periods, flags anomalies, and formats the output for daily standup or nightly review.
No external packages. No API wrappers. One self-contained Python script.
What You Get
- Daily snapshot — today vs. yesterday, net revenue, transaction count
- Weekly trend — last 7 days vs. prior 7 days, growth %
- Monthly view — last 30 days vs. prior 30 days, estimated MRR
- Multi-account support — consolidated or per-product breakdown
- Anomaly alerts — revenue spikes or drops >20% flagged automatically
- Refund tracking — gross vs. net separated
Setup (2 minutes)
Step 1: Save your Stripe API key:
mkdir -p ~/.config/stripe
echo "sk_live_XXXX" > ~/.config/stripe/api_key
chmod 600 ~/.config/stripe/api_key
Step 2: Create the script directory and save stripe-metrics.py (included below).
Step 3: Edit the ACCOUNTS dict in the script with your account name(s):
ACCOUNTS = {
"my_product": None, # None = default account
"my_saas": "acct_XXXX", # connected account ID
}
Step 4: Run it:
python3 stripe-metrics.py --period today
Usage
# Today vs yesterday
python3 stripe-metrics.py --period today
# Last 7 days vs prior 7 days
python3 stripe-metrics.py --period week
# Last 30 days vs prior 30 days
python3 stripe-metrics.py --period month
# All time totals
python3 stripe-metrics.py --period all
# JSON output (for piping / automation)
python3 stripe-metrics.py --period week --json
Sample Output
══════════════════════════════════════
STRIPE REVENUE — TODAY
══════════════════════════════════════
my_product
├─ Gross: $342.00
├─ Refunds: -$0.00
├─ Net: $342.00
└─ Transactions: 12
my_saas
├─ Gross: $189.00
├─ Refunds: -$29.00
├─ Net: $160.00
└─ Transactions: 7
──────────────────────────────────────
TOTAL NET: $502.00
vs Yesterday: $318.00 (+57.9%) 🟢
══════════════════════════════════════
The Script
Save this as stripe-metrics.py in any directory you prefer:
#!/usr/bin/env python3
"""
Stripe Revenue Intelligence
By PhantomWorks — https://phantomworks.io
No external packages required. Uses stdlib + Stripe REST API directly.
"""
import argparse
import json
import sys
import time
import urllib.request
import urllib.error
from datetime import datetime, timedelta, timezone
from pathlib import Path
# ─── CONFIGURATION ────────────────────────────────────────────────────────────
# Add your Stripe accounts here.
# Key = friendly name (shown in output)
# Value = Stripe Connect account ID, or None for your default account
ACCOUNTS = {
"default": None,
# "my_saas": "acct_XXXX",
}
API_KEY_FILE = Path.home() / ".config" / "stripe" / "api_key"
STRIPE_BASE = "https://api.stripe.com/v1"
ANOMALY_THRESHOLD = 0.20 # Alert if revenue changes >20%
# ─── API ──────────────────────────────────────────────────────────────────────
def get_api_key():
if API_KEY_FILE.exists():
return API_KEY_FILE.read_text().strip()
raise SystemExit("No Stripe API key found. See setup instructions.")
def stripe_get(path, params=None, account_id=None):
key = get_api_key()
query = ""
if params:
query = "?" + "&".join(f"{k}={v}" for k, v in params.items())
url = f"{STRIPE_BASE}{path}{query}"
req = urllib.request.Request(url)
import base64
token = base64.b64encode(f"{key}:".encode()).decode()
req.add_header("Authorization", f"Basic {token}")
if account_id:
req.add_header("Stripe-Account", account_id)
try:
with urllib.request.urlopen(req) as resp:
return json.loads(resp.read())
except urllib.error.HTTPError as e:
body = e.read().decode()
raise SystemExit(f"Stripe API error {e.code}: {body}")
# ─── METRICS ──────────────────────────────────────────────────────────────────
def get_revenue(start_ts, end_ts, account_id=None):
"""Fetch charges and refunds for a time window. Returns (gross, refunds, net, count)."""
gross = 0
refund_total = 0
count = 0
has_more = True
starting_after = None
while has_more:
params = {
"created[gte]": int(start_ts),
"created[lt]": int(end_ts),
"limit": 100,
"expand[]": "data.refunds",
}
if starting_after:
params["starting_after"] = starting_after
result = stripe_get("/charges", params, account_id)
charges = result.get("data", [])
for charge in charges:
if charge.get("status") != "succeeded":
continue
gross += charge.get("amount", 0)
count += 1
for refund in charge.get("refunds", {}).get("data", []):
refund_total += refund.get("amount", 0)
has_more = result.get("has_more", False)
if has_more and charges:
starting_after = charges[-1]["id"]
net = gross - refund_total
return gross / 100, refund_total / 100, net / 100, count
# ─── PERIODS ──────────────────────────────────────────────────────────────────
def get_period_bounds(period):
now = datetime.now(timezone.utc)
if period == "today":
start = now.replace(hour=0, minute=0, second=0, microsecond=0)
end = now
prev_start = start - timedelta(days=1)
prev_end = start
label, prev_label = "Today", "Yesterday"
elif period == "week":
start = now - timedelta(days=7)
end = now
prev_start = now - timedelta(days=14)
prev_end = start
label, prev_label = "Last 7 Days", "Prior 7 Days"
elif period == "month":
start = now - timedelta(days=30)
end = now
prev_start = now - timedelta(days=60)
prev_end = start
label, prev_label = "Last 30 Days", "Prior 30 Days"
elif period == "all":
start = datetime(2020, 1, 1, tzinfo=timezone.utc)
end = now
prev_start = prev_end = None
label, prev_label = "All Time", None
return start.timestamp(), end.timestamp(), \
(prev_start.timestamp() if prev_start else None), \
(prev_end.timestamp() if prev_end else None), \
label, prev_label
# ─── OUTPUT ───────────────────────────────────────────────────────────────────
def delta_arrow(current, previous):
if previous == 0:
return "+∞", "🟢"
pct = (current - previous) / previous * 100
sign = "+" if pct >= 0 else ""
arrow = "🟢" if pct >= 0 else "🔴"
anomaly = " ⚠️ ANOMALY" if abs(pct) > ANOMALY_THRESHOLD * 100 else ""
return f"{sign}{pct:.1f}%{anomaly}", arrow
def fmt(amount):
return f"${amount:,.2f}"
def print_report(results, period_label, prev_label, as_json=False):
if as_json:
print(json.dumps(results, indent=2))
return
bar = "═" * 42
thin = "─" * 42
print(f"\n{bar}")
print(f" STRIPE REVENUE — {period_label.upper()}")
print(f"{bar}\n")
total_net = 0
total_prev = 0
for name, data in results.items():
if name == "_totals":
continue
g, r, n, cnt = data["gross"], data["refunds"], data["net"], data["count"]
print(f" {name}")
print(f" ├─ Gross: {fmt(g):>12}")
if r > 0:
print(f" ├─ Refunds: {fmt(-r):>12}")
print(f" ├─ Net: {fmt(n):>12}")
print(f" └─ Txns: {cnt:>12}")
print()
total_net += n
if "prev_net" in data:
total_prev += data["prev_net"]
print(thin)
print(f" TOTAL NET: {fmt(total_net):>12}")
if prev_label and total_prev is not None:
pct_str, arrow = delta_arrow(total_net, total_prev)
print(f" vs {prev_label:<10} {fmt(total_prev):>12} ({pct_str}) {arrow}")
print(f"\n{bar}\n")
# ─── MAIN ─────────────────────────────────────────────────────────────────────
def main():
parser = argparse.ArgumentParser(description="Stripe Revenue Intelligence")
parser.add_argument("--period", choices=["today", "week", "month", "all"],
default="today")
parser.add_argument("--json", action="store_true", help="JSON output")
args = parser.parse_args()
start, end, prev_start, prev_end, label, prev_label = get_period_bounds(args.period)
results = {}
for name, account_id in ACCOUNTS.items():
g, r, n, cnt = get_revenue(start, end, account_id)
entry = {"gross": g, "refunds": r, "net": n, "count": cnt}
if prev_start:
_, _, pn, _ = get_revenue(prev_start, prev_end, account_id)
entry["prev_net"] = pn
results[name] = entry
print_report(results, label, prev_label, as_json=args.json)
if __name__ == "__main__":
main()
Nightly Review Workflow
Pair with your daily review skill or cron job:
# In your nightly heartbeat or cron
python3 ~/scripts/stripe-metrics.py --period today
python3 ~/scripts/stripe-metrics.py --period month
Outputs JSON (--json) for piping into other tools or Slack notifications.
Multi-Account Setup
If you run multiple Stripe products on connected accounts:
ACCOUNTS = {
"product_a": None, # default account
"product_b": "acct_1234", # connected account
"product_c": "acct_5678", # connected account
}
Each account is fetched and reported separately, with a consolidated total.
Troubleshooting
"No Stripe API key found" — Run echo "sk_live_XXXX" > ~/.config/stripe/api_key
Revenue shows $0 — Check your created[gte] window. Stripe uses UTC timestamps; today may be empty if you're in a non-UTC timezone and it's early.
HTTP 401 — Wrong API key. Check that you're using a live key (sk_live_...), not a test key.
Connected account errors — Ensure the Stripe account ID starts with acct_ and the platform has access.
Built by PhantomWorks — tools for founders who want to know their numbers without opening a browser.
Core Capabilities
- stripe revenue
- stripe metrics
- mrr
- revenue dashboard
- stripe analytics
- daily revenue
- stripe report
Customer ratings
0 reviews
No ratings yet
- 5 star0
- 4 star0
- 3 star0
- 2 star0
- 1 star0
No reviews yet. Be the first buyer to share feedback.
Version History
This skill is actively maintained.
May 14, 2026
Initial release — daily/weekly/monthly Stripe revenue analytics with multi-account support and anomaly detection.
One-time purchase
$12
By continuing, you agree to the Buyer Terms of Service.
Details
- Type
- Skill
- Category
- Productivity
- Price
- $12
- Version
- 1
- License
- One-time purchase
Works With
Requires OpenClaw runtime features.
Works great with
Personas that pair well with this skill.
Project Manager Agent
Persona
Goals into plans. Plans into shipped work.
$34
ClawMart QA Review Shield
Persona
Preflight ClawMart packages for originality, safety, installability, and buyer usefulness before anyone hits publish.
$24

3D Print Farm Manager
Persona
AI-powered farm management from a real 33-printer operation
$14.99