A Flask-based web application for analyzing credit card transactions, calculating cashback rewards, and comparing against bank statements.
- PDF Parsing: Extract transactions from credit card PDF statements
- Cashback Calculation: Automatically calculate cashback based on spending categories
- CSV/Excel Import: Upload transaction sheets in CSV or Excel format
- Multi-Card Support: Track multiple credit cards/issuers
- Spending Analytics: View spending breakdown by category, issuer, and month
- Cashback Comparison: Compare calculated cashback vs. stated amounts
The application features a dark-themed interface with four main tabs:
Displays a summary dashboard with key metrics:
- Total transactions count
- Purchases (DR) and Credits (CR) breakdown
- Total spend amount
- Earned cashback amount
- Number of statements processed
Each card issuer can be expanded to show transactions grouped by month, with spend and cashback summaries per month.
Interactive visual analytics:
- Spending by Category: Pie chart showing spending distribution across categories
- Monthly Cashback Trend: Line chart tracking cashback earnings over time
- Top Spending Categories: Bar chart ranking categories by spending
- Category Details: Expandable table with per-category statistics
View all credit cards in one place:
- Each card shows total transactions, spending, and cashback
- Click to expand and see monthly breakdown
- Per-month statistics with spend and cashback totals
Complete transaction history with advanced filtering:
- Date range filter (From/To month selectors)
- Year-based filtering for each card
- Expandable month groups showing individual transactions
- Cashback comparison columns: Calculated vs Earned vs Credited
- Percentage difference indicator for each month
- Detailed transaction table with date, type, description, amount, category, rate, and cashback
- Overview: High-level summary with expandable issuer/month groups
- Dashboard: Visual charts and analytics
- Cards: Per-card transaction views
- Transactions: Complete transaction list with filtering
- Upload PDF: Drag and drop or click to upload credit card statements
- Clear All: Remove all data from the system
- Reload: Re-process all uploaded PDFs
- Select From/To months to filter all views
- Click "All" to show complete transaction history
- Filters apply across Overview, Dashboard, and Transactions tabs
Each transaction displays:
- Date and description
- Transaction type (DR = Purchase, CR = Credit)
- Amount in local currency
- Auto-detected category
- Cashback rate applied
- Calculated cashback amount
| Category | Rate |
|---|---|
| Grocery | 10% |
| Dining | 10% |
| Utilities | 10% |
| Airtel | 25% |
| Fuel | 1% |
| Travel | 1% |
| Entertainment | 1% |
| Shopping | 1% |
| Default | 1% |
Note: Airtel cashback is capped at Rs. 250 per month.
Cashback Calculator/
├── app.py # Flask application and API endpoints
├── requirements.txt # Python dependencies
├── backend/
│ ├── pdf_parser.py # PDF statement parser
│ ├── cashback_calculator.py # Cashback calculation logic
│ └── data_manager.py # Data storage and organization
├── data/
│ └── transactions.json # Transaction data storage
├── uploads/ # Uploaded PDF files
└── static/ # Frontend files
-
Create virtual environment:
python -m venv venv
-
Activate virtual environment:
- Windows:
venv\Scripts\activate - Mac/Linux:
source venv/bin/activate
- Windows:
-
Install dependencies:
pip install -r requirements.txt
python app.pyThe application runs at http://localhost:5000
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/transactions |
Get all transactions with organized data |
| GET | /api/transactions/csv |
Get transactions from JSON file |
| POST | /api/upload-pdf |
Upload and parse a PDF statement |
| POST | /api/upload-sheet |
Upload CSV/Excel sheet |
| POST | /api/reload-data |
Reload all transactions from PDFs |
| GET | /api/compare |
Compare calculated vs stated cashback |
| POST | /api/clear |
Clear all stored data |
| GET | /api/debug |
Debug info about stored data |
Transactions are stored in data/transactions.json:
{
"date": "2026-03-15",
"description": "AMAZON MARKETPLACE",
"amount": 45.99,
"transaction_type": "DR",
"card_issuer": "Chase Sapphire",
"category": "Shopping",
"is_credit": false,
"calculated_cashback": 0.46
}MIT