Google Play Sync
Overview
100% match with bank payout
Implementation
- Core sync logic:
src/lib/server/google-play-sync.ts - API endpoints:
src/routes/api/sync/google-play/
More details
Primary source: Google Play Earnings report
- Extremely accurate - 100% match with bank payout
- Available on 5th day for the previous month
- Dates input for fetch: month
- When data becomes available, how many days may the source adjust them: 0days (Claude told me)
Secondary source: Google Play Sales report
- Less accurate - 98.77% match with bank payout - but available almost immediately (1 day delay)
- Will be overwritten by earnings report when available
- Dates input for fetch: month
- When data becomes available, how many days may the source adjust them: 14days (Claude told me, conservative)
How sync works
<!-- The sync can be triggered any time. So it needs to be idempotent,
can handle situations when it's wasn't run for a long period of time,
and also don't do anything if already ran today.
The fetching function will write the data to DB, and immediately update
the lastSyncDate if got higher value. So if it sucessfuly saved data for 12 december, and
the lastSyncDate is currently 8 december it would udpate it to 12 december.
Note the date ranges are always inclusive. -->
if ( lastSyncDate < today ):
<!-- Order matter here -->
fetchDataFromEarningsReports( months: getMonthsBetweenInclusive(month_before_last_sync_date, previous_month))
fetchDataFromSalesReports ( months: [previous_month, current_month])
How the accuracy was measured + ground truth data for testing
Using only Earnings report
- google play revenue - Jan 1 - Nov 30, 2025 (UTC)
- arrived to bank account - 94275 €
- reported by this finboard - 94274.62 €
Using only Sales reports
- google play revenue - Jan 1 - Nov 30, 2025 (UTC)
- arrived to bank account - 94275 €
- reported by this finboard - 95452 €