← Back to all products

Payment Analytics

$19

Payment analytics dashboard with revenue tracking, success rates, and chargeback monitoring.

📁 9 files
JSONMarkdownPython

📄 Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample

📁 File Structure 9 files

payment-analytics/ ├── LICENSE ├── README.md ├── examples/ │ └── payments.json ├── free-sample.zip ├── guide/ │ ├── 01_features.md │ ├── 02_cli-reference.md │ └── 03_metrics-explained.md ├── index.html └── src/ └── payment_analytics.py

📖 Documentation Preview README excerpt

Payment Analytics

Part of the Payment Stack by CodeVault

A SaaS payment analytics engine that calculates MRR, ARR, churn rate, LTV, failed payment tracking, and revenue forecasting. Reads payment data from JSON and outputs actionable metrics for board meetings and daily monitoring.

Features

  • Monthly Recurring Revenue (MRR) with breakdown: new, expansion, contraction
  • Annual Recurring Revenue (ARR) and average revenue per customer (ARPC)
  • Customer churn rate and revenue churn rate
  • Customer Lifetime Value (LTV): average, median, and P90
  • Failed payment analysis with error code ranking and revenue at risk
  • Revenue forecasting with month-over-month growth projection
  • Full dashboard combining all metrics in one report
  • Built-in demo with 12 months of realistic simulated data
  • Python stdlib only — zero dependencies

Quick Start


# Run the full demo (generates sample data automatically)
python src/payment_analytics.py --action demo

# Full dashboard from your data
python src/payment_analytics.py --action dashboard --input examples/payments.json

# MRR breakdown
python src/payment_analytics.py --action mrr --input examples/payments.json

# Churn analysis
python src/payment_analytics.py --action churn --input examples/payments.json

# Customer lifetime value
python src/payment_analytics.py --action ltv --input examples/payments.json

# Failed payment analysis
python src/payment_analytics.py --action failures --input examples/payments.json

# Revenue forecast (next 12 months)
python src/payment_analytics.py --action forecast --input examples/payments.json --months 12

CLI Reference

FlagDescription
--action, -aAction to perform (required)
--inputJSON file with payment records
--monthsMonths to forecast (default: 6)
--verbose, -vEnable debug logging

Input Format

Payment records should be a JSON array (or {"payments": [...]}) where each record has:

FieldTypeRequiredDescription
idstringYesUnique payment ID
customer_idstringYesCustomer identifier

... continues with setup instructions, usage examples, and more.

📄 Code Sample .py preview

src/payment_analytics.py #!/usr/bin/env python3 """ Payment Analytics — Payment Stack by DataNest A payment analytics engine that calculates key SaaS and payment metrics: MRR, ARR, churn rate, LTV, failed payment tracking, revenue forecasting, and cohort analysis. Reads payment data from JSON and outputs reports. Why this exists: Revenue metrics are the heartbeat of any SaaS business, but calculating them correctly is harder than it looks. MRR isn't just "sum of payments" — you need to account for upgrades, downgrades, churned customers, and failed payments. This tool does the math right and gives you the numbers that matter for board meetings, investor decks, and daily decisions. Usage: python payment_analytics.py --action dashboard --input payments.json python payment_analytics.py --action mrr --input payments.json python payment_analytics.py --action churn --input payments.json python payment_analytics.py --action forecast --input payments.json --months 6 python payment_analytics.py --action demo License: MIT """ from __future__ import annotations import argparse import json import logging import math import sys from collections import defaultdict from dataclasses import dataclass, field, asdict from datetime import datetime, timedelta, timezone from pathlib import Path from typing import Any, Optional # --------------------------------------------------------------------------- # Constants # --------------------------------------------------------------------------- LOG = logging.getLogger("payment-analytics") # Standard month length for normalization (30.44 days = 365.25/12) DAYS_PER_MONTH = 30.44 # --------------------------------------------------------------------------- # Data Models # --------------------------------------------------------------------------- # ... 693 more lines ...
Buy Now — $19 Back to Products