Summary
Closing daily books on a dedicated iGaming payment gateway infrastructure with an on-demand treasury settlement architecture ties out to the exact baht once finance anchors every report to `completed_at_utc7`. In our `2026-12-01` (`00:00:00–23:59:59 UTC+7`) workbook dataset, the `200,000.00 THB` opening available balance plus `+34,125.00 THB` in net completed pay-ins (`35,000.00 THB` gross minus `875.00 THB` at 2.5%), minus `20,200.00 THB` in net completed payouts (`20,000.00 THB` gross plus `200.00 THB` at 1.0%), minus a `100,000.00 THB` on-demand settlement sweep equals `113,925.00 THB` at `23:59:59 UTC+7`. Every apparent gap comes down to three items: `1,075.00 THB` in completed fees, a `15,000.00 THB` midnight cut-off deposit (`ORD-261201-005`), and a `3,000.00 THB` unmatched sender hold (`ORD-261201-004`).
01Why the Three Daily Totals Never Match at First Glance
Shortly after `00:00:00 UTC+7` each morning, iGaming finance managers and controllers open three core reports to close the prior day's books: the Payment Gateway Available Balance ledger, the internal Player Wallet credit/debit log, and the Company Bank or USDT arrival statement. At first glance, the headline numbers on those three screens never match, often triggering hours of manual spreadsheet hunting.
Those figures differ not because cash is missing, but because each ledger tracks a distinct accounting boundary. Your Player Wallet records gross gaming liability: a `10,000.00 THB` deposit credits `10,000.00 THB` in playable chips, and an `8,000.00 THB` withdrawal debits `8,000.00 THB`. Conversely, the Gateway Available Balance is an append-only net cash ledger that deducts completed transaction fees immediately and drops whenever treasury sweeps funds out.
Midnight timing boundaries and sender-verification holds add two further layers of divergence. An order created just before midnight can clear at the player's bank just after midnight, while transfers from unregistered third-party accounts are quarantined outside available balance. Separating fees, midnight transits, and compliance holds turns a chaotic morning scramble into a ten-minute close.
02Inside the 3 Downloadable Sample CSVs for the 2026-12-01 Exercise
To make every formula testable in Excel, Python, or SQL, we prepared a complete dataset for `2026-12-01 00:00:00–23:59:59 UTC+7` across three files. First is the sample Gateway Ledger export (CSV), containing nine immutable rows from `OPEN-20261201` (`200,000.00 THB` opening balance) through every completed pay-in, payout, settlement sweep, and held exception to `CLOSE-20261201` (`113,925.00 THB` closing balance).
Second is the sample Player Wallet transaction log (CSV), covering rows `WLT-50001` to `WLT-50007`. It logs `order_created_at_utc7` alongside `wallet_posted_at_utc7`, player IDs (`PLY-1042` through `PLY-1310`), signed `webhook_event_id` keys (`evt_01JDF8A1` through `evt_01JDFG99`), and operational notes—including `WLT-50005` (`WD-261201-002`), where idempotency preserved a single `-12,000.00 THB` debit despite a client retry.
Third is the sample Daily Settlement and Reconciliation Statement (CSV), which organizes treasury arrivals and reconciling schedules into four explicit buckets: `SAME_DAY_CLEARED`, `FEE_VARIANCE_EXPLAINED`, `IN_TRANSIT_MIDNIGHT`, and `UNMATCHED_SENDER_HOLD`. Across all three CSV files, `merchant_ref_id` acts as the deterministic join key.
03Master Tie-Out: Walking from 200,000.00 THB Opening to 113,925.00 THB Closing Balance
Begin by summing `COMPLETED` rows in `gateway-ledger-sample.csv` with `completed_at_utc7` inside `2026-12-01 00:00:00–23:59:59`. Starting from `OPEN-20261201` (`200,000.00 THB`), three pay-ins completed: `ORD-261201-001` (`LGR-900101` at `09:12:18`, PromptPay QR `+10,000.00 THB` gross, `-250.00 THB` fee, `+9,750.00 THB` net, balance `209,750.00 THB`), `ORD-261201-002` (`LGR-900102` at `11:05:42`, PromptPay QR `+5,000.00 THB` gross, `-125.00 THB` fee, `+4,875.00 THB` net, balance `214,625.00 THB`), and `ORD-261201-003` (`LGR-900104` at `16:48:33`, THB Bank Transfer `+20,000.00 THB` gross, `-500.00 THB` fee, `+19,500.00 THB` net). Completed pay-ins total `+35,000.00 THB` gross, `-875.00 THB` in 2.5% fees, and `+34,125.00 THB` net.
Two player payouts completed on December 1: `WD-261201-001` (`LGR-900103` at `14:22:09`, `-8,000.00 THB` gross, `-80.00 THB` fee at 1.0%, `-8,080.00 THB` net, moving balance from `214,625.00 THB` to `206,545.00 THB`) and `WD-261201-002` (`LGR-900106` at `21:15:27`, `-12,000.00 THB` gross, `-120.00 THB` fee at 1.0%, `-12,120.00 THB` net). Completed payouts total `-20,000.00 THB` gross, `-200.00 THB` in 1.0% fees, and `-20,200.00 THB` net.
After `ORD-261201-003` lifted available funds to `226,045.00 THB`, treasury executed an on-demand settlement `STL-261201-001` (`LGR-900105`, requested `19:28:04`, bank-credited `19:30:15`) for `-100,000.00 THB` (`0.00 THB` fee), bringing the balance to `126,045.00 THB`. Subtracting evening payout `WD-261201-002` (`-12,120.00 THB`) lands squarely on `CLOSE-20261201`: `200,000.00 + 34,125.00 - 20,200.00 - 100,000.00 = 113,925.00 THB`.
| Reconciliation Component | Player Wallet Gross (THB) | Gateway Fee (THB) | Net Ledger Delta (THB) | Running / Closing Balance (THB) |
|---|---|---|---|---|
| Opening Available Balance (OPEN-20261201 at 00:00:00) | - | 0.00 | 0.00 | 200,000.00 |
| 3 Completed Pay-ins (ORD-261201-001, 002, 003) | +35,000.00 | -875.00 (2.5%) | +34,125.00 | 234,125.00 (pre-outflow) |
| 2 Completed Payouts (WD-261201-001, 002) | -20,000.00 | -200.00 (1.0%) | -20,200.00 | 213,925.00 (pre-settlement) |
| 1 Completed On-Demand Settlement (STL-261201-001) | Not in Player Wallet | 0.00 | -100,000.00 | 113,925.00 |
| Closing Available Balance (CLOSE-20261201 at 23:59:59) | +15,000.00 net player | -1,075.00 | -86,075.00 net change | 113,925.00 |
04Variance #1: Resolving the 1,075.00 THB Fee Spread Between Gross Wallet and Net Ledger
Summing completed December 1 player rows in `player-wallet-sample.csv` (`WLT-50001` through `WLT-50005`) yields `+35,000.00 - 20,000.00 = +15,000.00 THB` in net wallet movement. Before the `100,000.00 THB` settlement sweep, Gateway operational cash flow was `+34,125.00 - 20,200.00 = +13,925.00 THB`. That `1,075.00 THB` spread is documented in `SUMMARY-FEES-20261201` (`FEE_VARIANCE_EXPLAINED`) inside `daily-settlement-sample.csv`.
Under SF PayGate's completed-transaction fee schedule, Thailand THB rails charge `2.5%` on completed pay-ins and `1.0%` on completed payouts, with `0` setup fee and `0` monthly fee. Line by line, pay-in fees (`250.00 + 125.00 + 500.00 = 875.00 THB`) plus payout fees (`80.00 + 120.00 = 200.00 THB`) equal `1,075.00 THB`, while pending, expired, failed, or held rows (`ORD-261201-004`) incur `0.00 THB`.
In your General Ledger, never alter Player Wallet logs to match net cash. Record `+15,000.00 THB` to Player Liability movement, `+13,925.00 THB` to Gateway Cash Asset (before corporate sweep), and `1,075.00 THB` to `Payment Processing Fee Expense` so GGR and VIP turnover metrics stay exact.
05Variance #2: Midnight Cut-Off and In-Transit Item (ORD-261201-005, 15,000.00 THB)
The second variance sits in `WLT-50007` and `CUTOFF-ORD-261201-005`. Player `PLY-1099` created a `15,000.00 THB` PromptPay QR deposit (`ORD-261201-005`) at `2026-12-01 23:58:50`, seventy seconds before midnight. The bank cleared the scan just after midnight at `2026-12-02 00:01:12`, and signed webhook `evt_01JDFG99` credited the player wallet at `2026-12-02 00:01:14` (`CREDITED_NEXT_DAY`).
Filtering back-office exports by `order_created_at_utc7` mistakenly pulls `ORD-261201-005` into December 1 deposits, inflating gross deposits to `50,000.00 THB` and creating a `15,000.00 THB` (`14,625.00 THB` net after `-375.00 THB` fee) break against the December 1 Gateway Ledger. Because the Gateway Ledger cuts off on `completed_at_utc7`, it books `ORD-261201-005` in the `2026-12-02` batch as `LGR-900201`.
Enforce one rule across every BI report and finance query: slice daily books strictly on `completed_at_utc7` and `wallet_posted_at_utc7`, never on `order_created_at_utc7`. Orders created before `23:59:59` that settle after `00:00:00` belong in `IN_TRANSIT_MIDNIGHT` and clear in the `D+1` opening tie-out.
06Variance #3: Unmatched Third-Party Sender Hold (ORD-261201-004, 3,000.00 THB)
The third exception is `ORD-261201-004`, created at `2026-12-01 21:40:10` by `PLY-1310` for `3,000.00 THB` via `THB_BANK_TRANSFER` from an unregistered third-party bank account. Sender-binding verification quarantined the funds under `HOLD-900107` (`MANUAL_REVIEW`) in `gateway-ledger-sample.csv` and `HOLD-ORD-261201-004` (`UNMATCHED_SENDER_HOLD`) in `daily-settlement-sample.csv`.
Across all three files, accounting treatment stays consistent: `completed_at_utc7` is blank, `gateway_fee_thb` is `0.00`, `net_ledger_delta_thb` is `0.00`, `running_available_balance_thb` remains `113,925.00 THB`, and `WLT-50006` stays `PENDING_REVIEW` with `0.00 THB` credited. Keeping mismatched transfers out of available balance blocks mule-account triangulation fraud.
Finance logs `ORD-261201-004` (`3,000.00 THB`) in a compliance suspense schedule linked to ticket `REQ-261201-88`, following the workflow in our account operations and issue escalation reference, until compliance completes verification or return processing.
07Line-by-Line Exception Answer Key Across All Three CSV Exports
With fees, midnight cut-offs, and sender holds separated, all eight `merchant_ref_id` records from December 1 reconcile with zero unexplained variance. Giving shift accountants a line-by-line answer key eliminates guesswork and stops ad-hoc manual wallet edits.
Note `WD-261201-002` (`LGR-900106` / `WLT-50005` at `21:15:27` for `-12,000.00 THB`), where the client retried once at `21:14:02`. Because `merchant_ref_id` enforces payout idempotency, SF PayGate executed a single transfer (`-12,120.00 THB` net) and preserved a single wallet debit.
Use the answer-key table below to benchmark your spreadsheet formulas or SQL scripts against the three sample CSVs.
| merchant_ref_id | Gateway Ledger & Net THB | Player Wallet & Gross THB | Statement Bucket | Accounting Treatment |
|---|---|---|---|---|
| ORD-261201-001 | LGR-900101 (+9,750.00) | WLT-50001 (+10,000.00) | FEE_VARIANCE (-250.00) | Book Dec 1; 250.00 THB (2.5%) fee expense |
| ORD-261201-002 | LGR-900102 (+4,875.00) | WLT-50002 (+5,000.00) | FEE_VARIANCE (-125.00) | Book Dec 1; 125.00 THB (2.5%) fee expense |
| WD-261201-001 | LGR-900103 (-8,080.00) | WLT-50003 (-8,000.00) | FEE_VARIANCE (-80.00) | Book Dec 1; 80.00 THB (1.0%) payout fee |
| ORD-261201-003 | LGR-900104 (+19,500.00) | WLT-50004 (+20,000.00) | FEE_VARIANCE (-500.00) | Book Dec 1; matched registered sender |
| STL-261201-001 | LGR-900105 (-100,000.00) | N/A (Treasury Sweep) | SAME_DAY_CLEARED (100,000.00) | Matched corporate bank credit at 19:30:15 |
| WD-261201-002 | LGR-900106 (-12,120.00) | WLT-50005 (-12,000.00) | FEE_VARIANCE (-120.00) | Book Dec 1; idempotent retry blocked |
| ORD-261201-004 | HOLD-900107 (0.00) | WLT-50006 (0.00 Pending) | UNMATCHED_SENDER_HOLD (3,000.00) | Suspense log under ticket REQ-261201-88 |
| ORD-261201-005 | Dec 2 LGR-900201 (+14,625.00) | WLT-50007 (+15,000.00 Dec 2) | IN_TRANSIT_MIDNIGHT (14,625.00 net) | Roll forward to 2026-12-02 opening batch |
08Multi-Currency & Treasury Nuances: HKD FPS (3.5% / 1.0%) and Dashboard USDT TRC20
Operators running both Thailand and Hong Kong traffic apply the same workbook per currency sub-ledger, never mixing raw THB and HKD balances before tie-out. Across 12 Hong Kong FPS banks, completed pay-ins carry a `3.5%` fee and completed payouts carry a `1.0%` fee—simply swap the pay-in fee check from `2.5%` to `3.5%` in your HKD sheet.
When reconciling treasury settlements under our USDT (TRC20) settlement specification, distinguish the two outbound doors: the API settlement queue accepts instructions `24/7` (like `STL-261201-001`), whereas Dashboard USDT (TRC20) settlements run daily inside `14:00–22:00 UTC+7`. Requests submitted outside `14:00–22:00 UTC+7` wait in queue for the next `14:00 UTC+7` window rather than failing.
Always call `/me/limits` and `/v1/settlements/preview` before confirming any settlement, archive the preview snapshot with your close packet, and book FX conversion spreads between THB/HKD and USDT to `FX Gain/Loss` rather than gateway fee expense.
09Automating the Daily Tie-Out with SQL and Scheduled Assertions
High-concurrency iGaming platforms processing thousands of daily PromptPay QR, bank transfer, and FPS transactions should automate this workbook through a `00:15 UTC+7` scheduled data-warehouse job or Python reconciliation runner. Loading signed webhook payloads into an immutable audit table alongside daily Gateway Ledger exports lets your automated pipeline verify `unexplained_variance_thb = 0.00` every morning before shift handover, paging finance only when an unexpected break or stale pending order exceeds threshold.
The verification query below enforces three core accounting invariants: first, it slices Gateway Ledger activity strictly by `completed_at_utc7` across `00:00:00–23:59:59 UTC+7`; second, it compares `wallet_posted_at_utc7` net player movements against net ledger deltas plus completed gateway fees; third, it isolates midnight cut-off straddle orders (`order_created_at_utc7` on Day D, `wallet_posted_at_utc7` on Day D+1) and surfaces `MANUAL_REVIEW` compliance holds in dedicated columns.
Run this ANSI SQL query directly against DuckDB, PostgreSQL, BigQuery, or Snowflake tables imported from our three downloadable sample CSV files to reproduce every exact figure from the December 1 exercise—`200,000.00 THB` opening balance, `+15,000.00 THB` net wallet postings, `-1,075.00 THB` completed fees, `-100,000.00 THB` corporate settlement, `113,925.00 THB` closing balance, `0.00 THB` unexplained variance, `15,000.00 THB` midnight transit, and `3,000.00 THB` sender hold.
WITH ledger_day AS (
SELECT
MAX(CASE WHEN entry_type = 'OPENING_BALANCE' THEN running_available_balance_thb END) AS opening_thb,
SUM(CASE WHEN status = 'COMPLETED' THEN gateway_fee_thb ELSE 0 END) AS total_fee_thb,
SUM(CASE WHEN entry_type = 'SETTLEMENT' AND status = 'COMPLETED' THEN net_ledger_delta_thb ELSE 0 END) AS settlement_thb,
MAX(CASE WHEN entry_type = 'CLOSING_BALANCE' THEN running_available_balance_thb END) AS closing_thb,
SUM(CASE WHEN status = 'MANUAL_REVIEW' THEN gross_amount_thb ELSE 0 END) AS manual_hold_thb
FROM gateway_ledger
WHERE COALESCE(completed_at_utc7, created_at_utc7) BETWEEN '2026-12-01 00:00:00' AND '2026-12-01 23:59:59'
),
wallet_day AS (
SELECT
SUM(CASE WHEN wallet_posted_at_utc7 BETWEEN '2026-12-01 00:00:00' AND '2026-12-01 23:59:59'
THEN player_credit_debit_thb ELSE 0 END) AS net_wallet_posted_thb,
SUM(CASE WHEN order_created_at_utc7 BETWEEN '2026-12-01 00:00:00' AND '2026-12-01 23:59:59'
AND wallet_posted_at_utc7 >= '2026-12-02 00:00:00'
THEN player_credit_debit_thb ELSE 0 END) AS midnight_cutoff_gross_thb
FROM player_wallet
)
SELECT
l.opening_thb, -- 200000.00
w.net_wallet_posted_thb, -- +15000.00
l.total_fee_thb, -- -1075.00
l.settlement_thb, -- -100000.00
l.closing_thb, -- 113925.00
(l.opening_thb + w.net_wallet_posted_thb + l.total_fee_thb + l.settlement_thb)
- l.closing_thb AS unexplained_variance_thb, -- 0.00
w.midnight_cutoff_gross_thb, -- 15000.00 (ORD-261201-005)
l.manual_hold_thb -- 3000.00 (ORD-261201-004)
FROM ledger_day l
CROSS JOIN wallet_day w;108-Step Daily Close Checklist for iGaming Finance & Treasury Teams
Embedding these three-way checks into a maker-checker morning Standard Operating Procedure (SOP) ensures shift handovers, late-night football match peaks, and public-holiday banking schedules never compromise ledger integrity. One treasury analyst prepares the daily reconciliation packet with CSV exports and preview snapshots attached, while a senior finance controller verifies zero unexplained variance before signing off.
Merchants reaching `50,000,000 THB` or `12,000,000 HKD` in verified 30-day completed transaction volume are eligible to request a case-by-case custom rate review through the Enterprise Volume Desk. When an approved fee schedule takes effect on a specific timestamp, store rate tiers in a versioned SQL reference table rather than hard-coding percentages so historical audits and go-forward closes both tie out accurately.
To test webhook-to-ledger CSV reconciliation in a dedicated Sandbox environment or align on-demand settlement workflows with your accounting team, reach out via the SF PayGate onboarding and consultation desk or message our single official contact channel on Telegram at `@SFPayGateAgent`.
- 1Lock the window to 00:00:00–23:59:59 UTC+7 per currency using completed_at_utc7 and wallet_posted_at_utc7.
- 2Verify today's OPENING_BALANCE equals yesterday's signed-off CLOSING_BALANCE.
- 3Join Gateway Ledger and Player Wallet rows on merchant_ref_id to confirm 100% gross parity.
- 4Recalculate completed fees (THB 2.5%/1.0%; HKD FPS 3.5%/1.0%) and book Processing Fee Expense.
- 5Match treasury settlements to bank credits or TRON USDT hashes with /me/limits and /v1/settlements/preview snapshots.
- 6Roll IN_TRANSIT_MIDNIGHT items to D+1 and confirm prior-night transits cleared in today's opening batch.
- 7Track MANUAL_REVIEW holds in the suspense register with their POST /api/me/issues ID (REQ-261201-88).
- 8Complete second-person controller sign-off confirming unexplained_variance = 0.00 and archive CSVs.
Frequently asked questions
- Why must daily reconciliation cut off on completed_at_utc7 instead of order_created_at_utc7?
- Because order_created_at_utc7 only reflects when a deposit request was opened, not when bank funds settled. In our CSVs, ORD-261201-005 was created at 2026-12-01 23:58:50, but cleared at 2026-12-02 00:01:12. Slicing by completed_at_utc7 keeps cash accounting 100% aligned with settled funds.
- Why does Gateway operational movement show +13,925.00 THB while the Player Wallet shows +15,000.00 THB?
- The Player Wallet logs gross player activity (+35,000.00 THB deposits minus 20,000.00 THB payouts = +15,000.00 THB), whereas the Gateway Ledger nets out 875.00 THB in 2.5% pay-in fees and 200.00 THB in 1.0% payout fees, totaling 1,075.00 THB (+13,925.00 THB net prior to settlement).
- How should accounting treat a MANUAL_REVIEW unmatched sender entry like ORD-261201-004 (3,000.00 THB)?
- Do not book revenue or credit the player wallet. Transfers from unregistered third-party accounts stay isolated outside available balance with 0.00 THB fee. Track the item in a suspense schedule under ticket REQ-261201-88 until compliance resolution.
- How do HKD FPS fees and Dashboard USDT (TRC20) windows change the daily tie-out?
- Keep a separate HKD sub-ledger using 3.5% pay-in and 1.0% payout fees. For treasury payouts, API instructions queue 24/7 while Dashboard USDT (TRC20) runs daily from 14:00 to 22:00 UTC+7—call /me/limits and /v1/settlements/preview first and separate FX spreads from gateway fees.
- What if a bank clears at 23:59:59 UTC+7 and the Player Wallet webhook posts at 00:00:01 UTC+7?
- Joining on merchant_ref_id and webhook_event_id pairs that split-second midnight delivery immediately so finance can accrue the player wallet entry on the same date as completed_at_utc7 without double-counting on D+1.
- How can our finance team escalate an unrecognized discrepancy or test CSV exports in Sandbox?
- Open a traceable ticket via POST /api/me/issues with the merchant_ref_id and request_id, or contact our team on our single official Telegram channel at @SFPayGateAgent.