Skip to content
NovaroPayDocs
2026-11-22.acaciacurrent
Theme
Merchant portal(opens in a new tab)

Reconcile a month

To close a month, you check that the payments it brought are the money your balance got for them. The payments report by final status date puts each payment in exactly one month, the month it succeeded, with what it added to your balance, net_amount. Your balance counts the same money by when it was written to it. The two agree but for the payments on the month’s edge, and this page shows how to find them.

  • A secret key of the account, for its payments report (Get reports through the API). A live key: the balance reports are of live mode only.
  • The month’s balance changes, balance_change_from_activity.itemized.1: every change of your balance, with what made it. A key cannot ask for it: it is asked for in the merchant portal, under Reports › New report › Balance changes, by whoever sees your whole balance, for every line, or by an admin or operator of your account, for its lines (Reports). Either has your account’s payment lines, all this page needs. That is on its way: until it is there, a month can be reconciled only once it is. Balance › Export CSV in the merchant portal has the same lines, but only over a period that ends now (today, the last 7 or 30 days, this month), so it does not hold a month that has ended.
  • Wait until the month is over: a period can end no later than one minute ago.
  1. Ask for the month’s payments by their final status date. Start and end the month at midnight in your market’s time zone, and ask for date_basis finalized, the default, with net_amount and fee_status among the columns:

    October 2026's payments, by final status date
    curl https://api.dev.novaro.ink/reporting/report_runs \
    -H "Authorization: Bearer sk_live_in_…" \
    -H "Idempotency-Key: 3f2a1b00-0000-4000-8000-000000000002" \
    -H "Content-Type: application/json" \
    -d '{
    "report_type": "payments.itemized.1",
    "parameters": {
    "interval_start": 1790793000,
    "interval_end": 1793471400,
    "timezone": "Asia/Kolkata",
    "date_basis": "finalized",
    "columns": ["payment_id", "merchant_reference", "account_id", "currency", "status",
    "finalized_at", "amount_credited", "fee_amount", "net_amount", "fee_status"]
    }
    }'

    Wait for the run and download its file as in Get reports through the API, or with its script: sh get-report.sh 1790793000 1793471400 payments.csv.

    payments.csv
    payment_id,merchant_reference,account_id,currency,status,finalized_at,amount_credited,fee_amount,net_amount,fee_status
    pay_in_01K8RCNVECTOR000000000000A1,order_8812,macc_01K7XAMPLE00000000000000,INR,succeeded,2026-10-05T14:02:11+05:30,1000.00,25.00,975.00,posted
    pay_in_01K8RCNVECTOR000000000000A2,order_8813,macc_01K7XAMPLE00000000000000,INR,succeeded,2026-10-20T09:15:40+05:30,1900.00,47.50,1852.50,posted
    pay_in_01K8RCNVECTOR000000000000A3,order_8814,macc_01K7XAMPLE00000000000000,INR,succeeded,2026-10-24T18:44:02+05:30,200.00,5.00,195.00,posted
    pay_in_01K8RCNVECTOR000000000000A4,order_8815,macc_01K7XAMPLE00000000000000,INR,failed,2026-10-27T11:30:00+05:30,,,,
    pay_in_01K8RCNVECTOR000000000000A5,order_8816,macc_01K7XAMPLE00000000000000,INR,succeeded,2026-10-31T23:59:58+05:30,500.00,12.50,487.50,posted
    pay_in_01K8RCNVECTOR000000000000A6,order_8817,macc_01K7XAMPLE00000000000000,INR,succeeded,2026-10-31T23:59:59+05:30,,,,not_posted
  2. Check that every payment is posted. A succeeded payment whose money is not in your balance yet has fee_status not_posted and no money in the file. Its money is written a moment after it succeeds, sometimes later: make the report again later, and it has its money. A payment that did not succeed has no fee_status and no money.

  3. Sum net_amount. It is what the month’s payments added to your balance: what was credited for each, less our fee, with the corrections made to it up to the month’s end. Sum it with a decimal type, not a float. Once every payment is posted, the month’s report shows the same money whenever you make it: a correction made after the month is in a later month’s balance, never in this report.

  4. Take the payments’ changes of the same month from your balance. Get balance_change_from_activity.itemized.1 over the same moments, the same month in the same time zone. Its lines of type payment on your account, whose source_id is the payment, are what payments moved your available balance by. A line with pending true is money held, not yet available: count the line that releases it, not the one that holds it. A correction is two lines: the amount before, taken back (“Payment corrected: the amount before”), and the corrected amount (“Payment corrected”).

    balance_changes.csv
    created_at,id,type,description,source_id,merchant_account_id,currency,pending,gross,fee,net,balance_after,fee_rule
    2026-10-30T10:00:00+05:30,ltx_in_01K8RCNVECTOR00000000000BA,settlement,Settlement,st_in_01K8RCNVECTOR0000000000000S1,,INR,false,-2000.00,0.00,-2000.00,7323.00,settlement 1% + 1.00 USDT
    2026-10-25T09:00:00+05:30,ltx_in_01K8RCNVECTOR00000000000B9,payment,Payment released,pay_in_01K8RCNVECTOR000000000000A3,macc_01K7XAMPLE00000000000000,INR,false,195.00,0.00,195.00,9323.00,
    2026-10-24T18:44:03+05:30,ltx_in_01K8RCNVECTOR00000000000B8,payment,Payment,pay_in_01K8RCNVECTOR000000000000A3,macc_01K7XAMPLE00000000000000,INR,true,200.00,5.00,195.00,,deposit 2.5%
    2026-10-22T12:00:00+05:30,ltx_in_01K8RCNVECTOR00000000000B7,payment,Payment corrected,pay_in_01K8RCNVECTOR000000000000A2,macc_01K7XAMPLE00000000000000,INR,false,1900.00,47.50,1852.50,9128.00,deposit 2.5%
    2026-10-22T12:00:00+05:30,ltx_in_01K8RCNVECTOR00000000000B6,payment,Payment corrected: the amount before,pay_in_01K8RCNVECTOR000000000000A2,macc_01K7XAMPLE00000000000000,INR,false,-2000.00,-50.00,-1950.00,7275.50,deposit 2.5%
    2026-10-20T09:15:41+05:30,ltx_in_01K8RCNVECTOR00000000000B5,payment,Payment,pay_in_01K8RCNVECTOR000000000000A2,macc_01K7XAMPLE00000000000000,INR,false,2000.00,50.00,1950.00,9225.50,deposit 2.5%
    2026-10-12T16:20:00+05:30,ltx_in_01K8RCNVECTOR00000000000B4,payment,Payment,pay_in_01K8RCNVECTOR0000000000000X1,macc_01K7OTHERACCOUNT00000000000,INR,false,1000.00,25.00,975.00,7275.50,deposit 2.5%
    2026-10-05T14:02:12+05:30,ltx_in_01K8RCNVECTOR00000000000B3,payment,Payment,pay_in_01K8RCNVECTOR000000000000A1,macc_01K7XAMPLE00000000000000,INR,false,1000.00,25.00,975.00,6300.50,deposit 2.5%
    2026-10-03T08:10:00+05:30,ltx_in_01K8RCNVECTOR00000000000B2,payment,Payment corrected,pay_in_01K8RCNVECTOR000000000000S9,macc_01K7XAMPLE00000000000000,INR,false,250.00,6.25,243.75,5325.50,deposit 2.5%
    2026-10-03T08:10:00+05:30,ltx_in_01K8RCNVECTOR00000000000B1,payment,Payment corrected: the amount before,pay_in_01K8RCNVECTOR000000000000S9,macc_01K7XAMPLE00000000000000,INR,false,-300.00,-7.50,-292.50,5081.75,deposit 2.5%
    2026-10-01T00:00:02+05:30,ltx_in_01K8RCNVECTOR00000000000B0,payment,Payment,pay_in_01K8RCNVECTOR000000000000S8,macc_01K7XAMPLE00000000000000,INR,false,300.00,7.50,292.50,5374.25,deposit 2.5%
  5. Join the two by the payment. The difference between the two sums is the payments whose money is in another month’s balance:

    • Succeeded in the month, written in the next. A payment that succeeded at 23:59:58 on 31 October may be written to your balance at 00:00:01 on 1 November. It is in October’s report, by its final status date, and in November’s balance.
    • Succeeded in the month before, written in this one. The same payment seen from November: in October’s report, and in November’s balance.
    • Corrected after its month. A correction of a September payment made in October is in October’s balance, and in no report’s money: September’s report holds the corrections up to September’s end.
    • Held at the month’s end, released in the next. On a market that holds a payment’s money until it is verified, a payment that succeeded in October and was still held on 31 October is in October’s report, and its release is in November’s balance: the held line is not available money.
    • A correction written across midnight. The report counts a correction by when its posting began, the balance by when each of its lines was written. A correction that began at 23:59:59 on 31 October and was written at 00:00:00 on 1 November is in October’s report and in November’s balance. It is rare, and the script below names it as a payment whose money differs: check the payment’s lines in November’s balance.

    So the month’s report, less what was written in the next month, plus what was written in this one for earlier payments, is the month’s payment lines of your balance.

The script below joins the two files by the payment and names the payments on the month’s edge. It exits with 1, and says why, when:

  • a payment’s money differs between the two: a correction written across midnight, or something to ask us about;
  • a payment not_posted in the report already has its money in the balance: make the report again;
  • the payments report has a row of another account than the one you name;
  • the report has payments but the balance changes have no line of that account, an empty file included: there is nothing to compare them with, so ask for the same month’s balance changes again (a month with no line of the account in either file says “Nothing to compare” and exits with 0);
  • it is not given two files and an account, macc_….

It is tested against these files:

reconcile.py
"""Reconcile a month's payments report with your balance's changes.
python3 reconcile.py payments.csv balance_changes.csv macc_…
payments.csv is payments.itemized.1 over the month by its final status date
(date_basis=finalized) with payment_id, account_id, currency, net_amount and
fee_status among its columns; balance_changes.csv is
balance_change_from_activity.itemized.1 over the same month; macc_… is
the account the payments report is of. It joins them by the payment, and
says which payments' money is in another month's balance. Exits 1 when a
payment's money differs between the two, and when the report has payments
but the balance file has no line of the account: nothing to compare them
with. A month with no line of the account in either says so.
"""
import csv
import sys
from collections import defaultdict
from decimal import Decimal
def rows(path):
# utf-8-sig reads past the byte order mark.
with open(path, encoding="utf-8-sig", newline="") as f:
yield from csv.DictReader(f)
def money(value):
return Decimal(value) if value else Decimal(0)
def reconcile(payments_csv, changes_csv, account, out=sys.stdout):
# The report: each payment's net_amount, as it succeeded in the month.
# A month without payments has no rows, so the account is named, not
# read from them.
in_file = {}
not_posted = []
for r in rows(payments_csv):
if r["account_id"] != account:
sys.exit(f"{payments_csv} has a payment of {r['account_id']}, not of {account}")
if r["fee_status"] == "not_posted":
not_posted.append(r["payment_id"])
elif r["fee_status"] == "posted":
in_file[r["payment_id"]] = (r["currency"], money(r["net_amount"]))
# The balance: what each payment of the same accounts moved your
# available balance by in the month. A pending line is held, not yet
# available: its release is a line of its own.
in_balance = defaultdict(Decimal)
currency_of = {}
lines = 0
for r in rows(changes_csv):
lines += r["merchant_account_id"] == account
if r["type"] != "payment" or r["merchant_account_id"] != account or r["pending"] == "true":
continue
in_balance[r["source_id"]] += money(r["net"])
currency_of[r["source_id"]] = r["currency"]
# A balance file without the account's lines (empty, or another
# account's) would show every payment as in a later month's balance.
if not lines and (in_file or not_posted):
sys.exit(f"{changes_csv} has no line of {account}: nothing to compare the report with. "
"Ask for the balance changes of the same month, with this account's lines.")
if not lines:
print(f"Nothing to compare: neither file has a line of {account}.", file=out)
return True
later = sorted(p for p in in_file if p not in in_balance)
earlier = sorted(p for p in in_balance if p not in in_file and p not in not_posted)
different = sorted(p for p in in_file if p in in_balance and in_file[p][1] != in_balance[p])
# Posted after the report was made: make the report again.
different += sorted(p for p in not_posted if p in in_balance)
file_total = defaultdict(Decimal)
balance_total = defaultdict(Decimal)
for p, (cur, net) in in_file.items():
file_total[cur] += net
for p, net in in_balance.items():
balance_total[currency_of[p]] += net
def show(title, ids, amount):
print(f"{title}: {len(ids)}", file=out)
for p in ids:
print(f" {p} {amount(p)}".rstrip(), file=out)
show("In the report, in a later month's balance", later, lambda p: f"{in_file[p][1]} {in_file[p][0]}")
show("In this month's balance, not in its report: succeeded earlier, or corrected in it", earlier, lambda p: f"{in_balance[p]} {currency_of[p]}")
show("Not posted yet: no money in the report", sorted(not_posted), lambda p: "")
show(
"Different in both",
different,
lambda p: f"report {in_file[p][1] if p in in_file else 'not posted'}, balance {in_balance[p]} {currency_of[p]}",
)
for cur in sorted(set(file_total) | set(balance_total)):
out_later = sum((in_file[p][1] for p in later if in_file[p][0] == cur), Decimal(0))
in_earlier = sum((in_balance[p] for p in earlier if currency_of[p] == cur), Decimal(0))
print(
f"{cur}: report {file_total[cur]} - later {out_later} + earlier {in_earlier}"
f" = {file_total[cur] - out_later + in_earlier}; balance {balance_total[cur]}",
file=out,
)
return not different
if __name__ == "__main__":
if len(sys.argv) != 4 or not sys.argv[3].startswith("macc_"):
sys.exit("usage: python3 reconcile.py payments.csv balance_changes.csv macc_…")
sys.exit(0 if reconcile(sys.argv[1], sys.argv[2], sys.argv[3]) else 1)
Terminal window
python3 reconcile.py payments.csv balance_changes.csv macc_01K7XAMPLE00000000000000

Name the account the payments report is of: a month without payments has no rows to read it from.

For the October above, it answers:

Output
In the report, in a later month's balance: 1
pay_in_01K8RCNVECTOR000000000000A5 487.50 INR
In this month's balance, not in its report: succeeded earlier, or corrected in it: 2
pay_in_01K8RCNVECTOR000000000000S8 292.50 INR
pay_in_01K8RCNVECTOR000000000000S9 -48.75 INR
Not posted yet: no money in the report: 1
pay_in_01K8RCNVECTOR000000000000A6
Different in both: 0
INR: report 3510.00 - later 487.50 + earlier 243.75 = 3266.25; balance 3266.25
  • pay_…A5 succeeded at 23:59:58 on 31 October: its 487.50 is in November’s balance.
  • pay_…S8 succeeded in September and was written on 1 October: its money is in October’s balance, and in September’s report. pay_…S9 is a September payment corrected in October: the correction is in October’s balance, and in no report’s money.
  • pay_…A6 is not posted yet: make October’s report again once it is.
  • pay_…A3 was held until verified: its held line is left out, and the line that released it is counted.

Your balance moves with settlements, payouts, adjustments and our fee refunds too. The balance summary, balance.summary.1, sums every change of the month by kind: its payments_net rows, one per account, are the payment lines of step 4, and opening_balance plus every change is closing_balance; the pending row, money held at the period’s end, is not a change of your available balance and is not in that sum. October’s closing balance is November’s opening balance (Reports).