← All projects

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.
Reseller back office with the purchase dashboard open beside a printed receipt

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

  1. 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.
  2. 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

Checking devices off a printed Apple Store receipt
One receipt could carry anywhere from 2 to 40+ devices, each needing its own line.
Flagged rows highlighted in the review queue
Tax mismatches and duplicates land in a review queue instead of the refund total.

  1. 01Apple ID account sync (documented as not technically feasible before contract)
  2. 02OCR/scanned-image parsing
  3. 03Full record-editing UI with audit trail
  4. 04Historical data migration
  5. 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.

Reporting dashboard with breakdowns by store and product

What shipped

  1. 01Gmail sync engine
  2. 02Multi-device PDF parser
  3. 03Tax engine with mismatch flagging
  4. 04Returns/credit matching
  5. 05IMEI duplicate detection
  6. 06Flagged-items review queue
  7. 07Search across date, store, card, employee, IMEI, SKU/colour
  8. 08Reporting by day, month, SKU, colour, location, card
  9. 09End-of-day reconciliation report listing missing IMEIs
  10. 10CSV export at one row per device, pre-tax/tax separated
  11. 11Bulk ZIP download of original PDFs foldered by month
  12. 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