Reconcile a Stripe CSV export with Postgres

Match a Stripe payments export against your own database with SQL. Find the charges Stripe has that you don't, the ones you have that Stripe doesn't, and the amounts that don't agree.
Download for Mac Free and open source (MIT) · Also available for Windows

By Tanin Na Nakorn · Updated

This is the job Superintendent was built for. I used to reconcile millions of rows of Stripe CSVs against our internal database. Spreadsheets choked on the file size, and scripts only showed me summaries. Here's the workflow I wanted then.

The setup: your app records each payment in a Postgres table called payments, with the Stripe charge ID, the customer, and the amount in cents. Finance says last month's revenue in Stripe doesn't match your dashboard. You need to find out which payments are off.

1. Export the payments from Stripe

In the Stripe Dashboard, open Payments, filter to last month, and export to CSV. You get a file like unified_payments.csv, with columns such as id, Created date (UTC), Amount, Currency, Status, and Customer ID.

2. Import it

Drop the file onto Superintendent. It becomes the table unified_payments, and the column names are cleaned up: Created date (UTC) becomes Created_date_UTC, and Customer ID becomes Customer_ID. Amount is detected as a number, so it can be summed right away.

3. Pull the same month from Postgres

Connect your database (+ next to Databases, then PostgreSQL). Open a query tab, choose the database next to Run, and select the same date range:

payments_last_month (on Postgres)
select stripe_charge_id, customer_id, amount_cents, status, created_at
from payments
where created_at >= date '2025-10-01'
  and created_at < date '2025-11-01'

Click Download to Workspace above the result. The rows are copied into the local workspace as the table payments_last_month, next to the Stripe export.

Screenshot coming soon The Download to Workspace button above a PostgreSQL query result in Superintendent images/screenshots/download_to_workspace.webp

4. Compare the totals

Back in a workspace query tab, start with the big picture:

totals
select 'stripe' as source, count(*) as payments, sum(Amount) as total
from unified_payments
where Status = 'Paid'
union all
select 'postgres', count(*), sum(amount_cents) / 100.0
from payments_last_month
where status = 'succeeded'
source payments total
1 stripe 48213 2,418,902.00
2 postgres 48197 2,417,288.00

Sixteen payments and $1,614 apart. Now find them.

5. Payments in Stripe but not in your database

missing_in_postgres
select s.*
from unified_payments s
left join payments_last_month p on p.stripe_charge_id = s.id
where s.Status = 'Paid'
  and p.stripe_charge_id is null

These are usually webhooks that failed or arrived late. Sort by Created_date_UTC in the grid: if they cluster around one time, you've found an outage.

6. Payments in your database but not in Stripe

missing_in_stripe
select p.*
from payments_last_month p
left join unified_payments s on s.id = p.stripe_charge_id
where p.status = 'succeeded'
  and s.id is null

Often these are payments recorded at the end of the day in one time zone and the next day in UTC. Widen the date range by a day on both sides to rule that out.

7. Amounts that don't match

amount_mismatches
select
  s.id,
  s.Customer_ID,
  s.Amount as stripe_amount,
  p.amount_cents / 100.0 as db_amount,
  s.Amount - p.amount_cents / 100.0 as difference
from unified_payments s
join payments_last_month p on p.stripe_charge_id = s.id
where s.Amount <> p.amount_cents / 100.0
order by abs(difference) desc

Partial refunds, currency conversions, and discounts applied after the fact show up here. Check one or two rows in the Stripe Dashboard. If a value in your database is wrong, open the payments table from the sidebar and fix it right in the grid.

8. Save it for next month

Save the workspace as a .super file. It keeps the database connection and every query above. Next month, import the new export in place of the old table, rerun the Postgres query, and the checks take a minute.

The same pattern works for any two sources: two CSV files, or two databases after a migration.

Questions

Why export from Stripe instead of using the API?

For a one-off or monthly check, the export from the Stripe Dashboard is the quickest way to get every payment in a date range, with no code to write.

Does my Postgres data get uploaded anywhere?

No. The query result is downloaded to the workspace on your computer, and the comparison runs there.

My Stripe export's column names look different. Does it matter?

Stripe's column names depend on the export and the columns you pick. After import, check the column list in the sidebar and adjust the names in the queries.

Can I rerun this next month?

Yes. Save the workspace as a .super file. Next month, import the new export in place of the old table, download the new Postgres result, and rerun the saved queries.

Try it on your own data

Free and open source. No account, no credit card. Your data stays on your computer.

Also available for Windows