This chapter covers the core features and capabilities of Payment Analytics.
# 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 12Follow this guide to get Payment Analytics up and running in your environment.
| Flag | Description |
|---|---|
--action, -a | Action to perform (required) |
--input | JSON file with payment records |
--months | Months to forecast (default: 6) |
--verbose, -v | Enable debug logging |
Payment records should be a JSON array (or {"payments": [...]}) where each record has:
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique payment ID |
customer_id | string | Yes | Customer identifier |
amount | int | Yes | Amount in cents |
currency | string | No | Currency code (default: "usd") |
status | string | Yes | "succeeded", "failed", or "refunded" |
plan | string | No | Plan/tier name |
interval | string | Yes | "month", "year", "quarter", "week", "one_time" |
created_at | string | Yes | ISO 8601 timestamp |
failure_code | string | No | Error code (for failed payments) |
Get the full Payment Analytics and unlock everything.
Get the complete guide with every chapter unlocked, including code samples, diagrams, and best practices.
Access all interactive tools with complete data, all workload profiles, and the full scenario library.
Downloadable source code, configuration files, and working examples from every chapter.
Free updates for life. Every new chapter, tool, and improvement included.