Tax-refund tracking for thousands of Apple device purchases
- Type
- Client engagement
- Sector
- Retail / Apple Authorized Reseller (US)
- Status
- Delivered
- Client
- A US-based Apple Authorized Reseller operating across NYC, Westchester, and Long Island.
The challenge
Tax-refund filing against thousands of Apple device purchases via a bloated general-purpose platform. Receipts arrived by email and manual download, 2–40+ devices per receipt, tax rates varying by store location, and returns plus duplicate store emails were corrupting refund totals.
Constraints
- 01Gmail read access is a Google "restricted scope" needing app verification that takes weeks — had to start before anything else to hit a September launch.
- 02Apple publishes no consumer order API; credential scraping violates their terms and breaks on 2FA.
2–40+
Devices on a single receipt
3
Store regions, each with its own tax rate
12
Features shipped, four unused tabs cut


- 01Apple ID account sync (documented as not technically feasible before contract)
- 02OCR/scanned-image parsing
- 03Full record-editing UI with audit trail
- 04Historical data migration
- 05Four unused tabs from the old platform (Sales, Gift Cards, Trade-Ins)
How we built it
Read-only Gmail OAuth sync on one inbox, auto-identifying Apple Store senders, grouped by location. A parser explodes each receipt into per-device line items (model, colour, storage, IMEI, serial, price, tax, location, timestamp). A location-to-rate tax table for NYC/Westchester/Long Island extracts the printed tax rather than recalculating it, flagging mismatches. IMEI is the universal key: dedup runs against it, credit receipts auto-match returns, and manually uploaded Apple.com PDFs flow into the same model with no second-stage reconciliation. Carrier tracking runs through an aggregator for shipped/delivered/exception states.
What shipped
- 01Gmail sync engine
- 02Multi-device PDF parser
- 03Tax engine with mismatch flagging
- 04Returns/credit matching
- 05IMEI duplicate detection
- 06Flagged-items review queue
- 07Search across date, store, card, employee, IMEI, SKU/colour
- 08Reporting by day, month, SKU, colour, location, card
- 09End-of-day reconciliation report listing missing IMEIs
- 10CSV export at one row per device, pre-tax/tax separated
- 11Bulk ZIP download of original PDFs foldered by month
- 12Two full-access partner accounts plus view-only employee access
Outcome
A focused platform replacing a general-purpose tool, covering only the workflows the client actually used.
Stack
- Python
- FastAPI
- Gmail API (OAuth restricted scope)
- PDF parsing
- PostgreSQL
- EasyPost-class tracking aggregator