AI helps with: 1) Identifying transactions in DB but not in settlement report (gap detection). 2) Flagging unusual patterns (merchant A usually settles T+1 but this batch took T+4). 3) Generating reconciliation summary reports. 4) Explaining what a discrepancy might mean in plain English. AI should NOT: autonomously create accounting entries, mark discrepancies as resolved without human sign-off, or modify financial records based on its own judgement.
// AI-assisted reconciliation: find gaps between DB and Paystack settlement
async function findReconciliationGaps(settlementCsv) {
// Parse settlement CSV
var settlementRefs = new Set(settlementCsv.map(row => row.reference));
// Get our DB transactions in the same date range
var dbTransactions = await db.transactions.findSuccessful({ from: settlementCsv[0].paid_at, to: settlementCsv.at(-1).paid_at });
var dbRefs = new Set(dbTransactions.map(t => t.reference));
var gaps = {
inDbNotSettled: dbTransactions.filter(t => !settlementRefs.has(t.reference)), // we think it's paid, Paystack didn't settle
settledNotInDb: [...settlementRefs].filter(r => !dbRefs.has(r)), // Paystack settled but we have no record
};
// Now feed gaps to LLM for explanation
var explanation = await callLLM({
prompt: 'Here are reconciliation gaps: ' + JSON.stringify(gaps) + '. Explain what each type of gap might mean and what action the finance team should take. Do not create any accounting entries — only explain.',
});
return { gaps, explanation }; // human reviews and takes action
}
The LLM provides plain-English explanation and suggested actions. A human finance officer reviews, verifies, and executes any corrections. AI never touches the accounting system directly.
Get weekly developer tips
Join 25,000+ developers. Practical guides, job tips, and new content — straight to your inbox.
No spam. Unsubscribe anytime.
See audit trails for AI financial actions for logging requirements.
KES 2,999
The definitive guide to building payment systems with Paystack — from your first transaction to production-grade payment infrastructure across Africa. 9 modules, 47 lessons. Free preview available.
Start Paystack Course