SENIORCHAPTER 44

The sending bank's side of a NIP transfer

A sending bank takes the customer's money before it knows the receiver has it. The suspense account holds that gap: money that is the customer's no longer and the receiver's not yet

55 MINPAYMENTSUPDATED 2026-11-18
PREDICT

Northmere's customers sent 184 NIP transfers on Thursday 18 June in the lab's model, and the bank's debit comes first on each one. For how long, in the middle of the day, does a typical transfer sit in the bank's suspense account, debited from the customer and not yet answered?

Chapter 2.7 showed a transfer from the point of view of a company that sends money out. A bank sends money out for millions of people, and it has a harder job, because the money it is moving is already in its books as a liability to the customer. The bank cannot treat “I have asked the switch” as the same thing as “it is done”. It needs places in its ledger for each stage in between, and rules for who may move money from one place to the next.

The lab covers one week on an instant-payment network seen from the switch, and every participant is invented. B05 in that world is Northmere Bank, so you replay Northmere’s Thursday. Every code, fee, limit and timing in the lab is illustrative: where this chapter states a real rule it is in a dated note with its source, and where it could not confirm one it says what to check.

What a sending bank does, in order

A customer who sends money through a banking app starts a chain, and the bank owns most of it. In the order the lab replays:

  1. Check the customer and the account. Is the account active, not frozen, not on “post no debit” (PND, a block on debits), within the customer’s limits for the day and the channel, and with enough balance for the amount and the fee? These are the bank’s own rules and the customer’s tier: chapter 6.3, on the receiving side, takes the tier rules apart.
  2. Ask whose account it is. The bank sends a name enquiry through the switch to the beneficiary’s bank and shows the name. A customer who pays a saved beneficiary again may be shown the name from the earlier enquiry, so the transfer has no enquiry of its own: that is true of 63 of Northmere’s 184 transfers in the lab’s Thursday. NIBSS describes NIP as an account-number-based, real-time electronic funds transfer platform where transaction messages travel from the sending institution to the receiving institution instantly, and lists name enquiry and direct credit among its servicesas of 2026-11. That description is from search summaries of NIBSS’s support page, which this build could not open.
  3. Get the customer’s confirmation. The customer has seen the name and the amount and has authenticated: authenticating the payer covers how.
  4. Debit the customer. The balance falls. The money is now in the bank’s hands and not in the customer’s.
  5. Send the instruction. The bank creates the transfer’s identifier and sends it to the switch. In the lab the identifier is a 30-digit session id that begins with the six-digit institution code of the sender, so a switch can tell at a glance which bank made it. That layout is the lab’s: this chapter did not find NIBSS’s published layout, so ask your sponsor or NIBSS for the specification before you build against it.
  6. Act on the answer. Yes, a definite no, or no answer.

Steps 4 and 6 are where the ledger lives, and the rest of this chapter is about them. The lab’s bank_log table is the bank’s own record of that chain, one row per outward transfer, and the switch’s transfers table is the same transfer seen from the middle. Replaying the first against the second is how an operations team proves that the bank did what it says it did.

customerliability to hernip_suspensein transitsettlement positionowed to the switchfee incomethe bank’s own1 debit, send2 yes2 definite no2 yes: the feeno answer: stay in suspense and ask the switch

Debit first, and the two ways to get the order wrong

There are two orders: send first and debit after, or debit first and send after. Both can be made to work, and one is much safer to get wrong.

Send first, debit after. The instruction goes to the switch, the switch says yes, and then the bank debits the customer. If the system fails between the answer and the debit, the money has left the bank and the customer still has it. The bank has paid for her. She can spend the same money again before anybody notices. A customer with ₦10,000 and a fast hand can send ₦10,000 twice. This order also lets a customer send money she does not have, because nothing checked the balance at the moment that mattered.

Debit first, send after. The balance falls, a record is made that the bank did it, and then the instruction goes. If the system fails between the two, the customer is debited and nothing was sent. That is a failure the bank can find: a debit with no instruction behind it is a row in suspense that never gets an answer, and the bank puts it back. It costs the customer a wait and costs the bank a complaint, and the money is safe.

So banks debit first, and the lab’s bank_log is built that way. The rule that follows is the one from payment states and refunds: the debit and the record that it happened must be written together, in one database transaction, before the instruction is sent. The instruction’s identifier must be made before the send and stored with the debit, so that a retry after a crash sends the same identifier and the switch can refuse the repeat. This is idempotency, as chapter 2.2 taught, applied to the debit.

The suspense account

After the debit, the customer’s balance has fallen by ₦7,693 and nobody has the money. It is not the receiver’s: the switch has not said yes. It is not the customer’s: her balance is lower. A ledger cannot say “in the air”, so the bank opens an account for it. In the lab it is called nip_suspense. It is a liability, because the bank owes this money to one of two parties, and which one is not known yet. A suspense account is not a place where mistakes are hidden. It is the correct account for money in a known state of transit, and an examiner or an auditor will ask to see its ageing.

Here is one transfer from the lab, Thursday at 00:14, ₦7,693 (769,300 kobo) from a B05 customer to B17, with a fee due of ₦25 (2,500 kobo). The switch answered 00 after 1,687 ms. The postings are:

When Account Debit (kobo) Credit (kobo)
00:14:49, the debit customer 769,300
nip_suspense 769,300
00:14:49, 1,687 ms later, the yes nip_suspense 769,300
nip_settlement_position 769,300
customer 2,500
fee_income 2,500

Each posting balances: 769,300 on each side, then 769,300 + 2,500 = 771,800 on each side. Suspense is back to zero. The customer is down ₦7,718, and the bank now owes the settlement ₦7,693. The settlement position is the account that is netted against the money other banks sent to B05 and settled at the next session. How banks settle with each other is a later chapter’s subject; for now treat the position as what the bank owes the scheme for what it has sent. The switch’s own fee to the bank is also due on each successful transfer. It belongs to a later chapter on what a transfer earns a bank, and the postings here leave it out.

When the answer is a definite no, the customer is put back. A transfer on Tuesday 16 June, ₦5,933 (593,300 kobo) to S02, got 57, “not permitted” (the lab’s code for a frozen receiving account), in 460 ms. The bank debited her at 12:35:22 and credited her back at 12:36:02. For those 40 seconds the money sat in suspense, though the answer was known at once. That 40 seconds is the lab’s model, not a rule: a bank that put the customer back at the moment of a clean refusal would hold nothing at all. No fee was charged, because the transfer did not complete. The lab’s choice is to charge the fee on success. A bank could charge at the debit and refund on failure, and the next section says why that is a decision with a cost.

The third answer is none. The lab’s switch gives a transfer 30 seconds, and a transfer at 15:25 on Thursday to B01 for ₦44,224 (4,422,400 kobo) got no answer. This is the lab’s code 97, a timeout, and the chapter on payment states called it the extra state, “unknown”. The bank has two honest options: the money stays in suspense, and the bank asks the switch what happened. In the lab the answer arrived at 15:52:36, twenty-seven minutes after the debit, and it was 25, “no record”. Then, and only then, did the bank credit the customer. A second timeout started at 15:30:12, for ₦13,324 (1,332,400 kobo), and its status query at 15:34:05 said 00: the receiver had been credited, so the bank completed it and charged the fee. At 15:31 the suspense account held ₦57,548, which is the sum of both. That is the number Fatai’s branch needed. Both fell in the switch’s degraded spell from 15:20 to 15:34, which the lab’s outages table records.

What the bank may decide when the answer is silence

The table sets out what each answer lets the sending bank do. The codes are the lab’s, modelled on the style of NIP codes. The real list comes from your sponsor or from NIBSS under whatever terms they set, and this chapter could not find it published.

First answer What it means The bank’s move May the bank put the customer back?
00 The receiver was credited Complete: suspense to position, charge the fee No: the money has gone
57, 91, 51 A definite refusal Reverse at once Yes
97, or no answer Unknown Keep in suspense, requery Not until the status query says no record
09 In progress (the lab’s week has none) Keep in suspense, requery Not until the status query says so

The row that matters most is the third. A timeout is not a failure: in the lab’s switch, 97 leaves the transfer’s real outcome open, and the switch’s own data says that a share of timeouts ended with the receiver credited. A bank that reverses the customer on silence will, now and then, pay her back for money the receiver already has. The customer is then paid twice, once by the receiver’s credit and once by the reversal, and the bank is short by the amount. Four senders in the lab’s week did exactly this: the largest loss was ₦16,295 on a single transfer. Chapter 6.4, on debited-but-not-credited, follows those cases; the lab’s step 5 shows the mechanism in a small model.

The opposite habit has its own cost. A bank that waits for the status query is not safe if it asks too early, because an early query can answer “no record” about a transfer still on its way. In the lab, three of Northmere’s four timeouts on Thursday were first queried 28, 27 and 3 minutes after the debit. The fourth, ₦7,658 to B12 at 12:35, was put back 40 seconds after the debit with no query on record. It came out right on this data, because no credit followed, but the bank could not have known that. Chapter 6.4 measures how early and how often banks ask. What you need here is the rule: put money back on a definite no, and on silence only after the switch says it has no record.

The customer’s fee

The sending bank earns its fee from the customer, at its own price. The lab’s fee has three bands, ₦10 up to ₦5,000, ₦25 up to ₦50,000 and ₦50 above, and the lab’s generator set them. They are illustrative. The real guide is the CBN’s. The CBN’s Guide to Charges by Banks, Other Financial and Non-Bank Financial Institutions took effect on 1 January 2020, and search summaries and press reports of it give a three-band scale for electronic transfers: ₦10 for amounts up to ₦5,000, ₦25 for ₦5,001 to ₦50,000 and ₦50 above ₦50,000as of 2026-11. Those bands come from summaries and press coverage, because this build could not open the guide. One report puts the ₦50 band at ₦50,000 and above, and some 2022 reports still describe the 2020 changes as new, so read the guide for the exact boundaries, who may charge what and whether a later version has replaced it. This chapter found no source for a change to the bands, so check the CBN’s own site before you build a fee table.

When is the fee taken? Three designs are common and each has a cost.

Design What the customer sees The cost
Charge at the debit, refund on failure Amount and fee gone together Every failed transfer needs a fee refund, and a missing refund is a complaint
Charge on the yes (the lab) The fee appears when the transfer completes The fee posting is a separate step that can fail on its own
Charge in a daily batch A fee line the next day The balance check at the debit must reserve for the fee

The lab’s design makes the failure easy to see. The bank’s log holds two numbers for each completed transfer: the fee it charged, and, in the switch’s table, the fee due for that amount. Comparing the two over the week finds six completed transfers where the bank charged nothing, at five banks: two at B01 (₦25 on a ₦7,908 transfer and ₦50 on a ₦119,141 one) and one each at B06 (₦25 on ₦5,321), B09 (₦10 on ₦2,636), B10 (₦25 on ₦6,177) and S02 (₦25 on ₦13,958), ₦160 in all. None is Northmere’s: its log charged in full on all 1,013 completed transfers in the week, which is the result you want from a control, and the reason to keep it running. The ledger did not object, because a transfer with no fee posting still balances. Only a comparison against what is due finds a fee that was never posted. That is why a sending bank runs a fee reconciliation every day, and why the same idea turns up in the chapter on reconciliation.

Rules that bind the sender

Three kinds of rule touch this side of a transfer, and each is a dated fact.

The CBN’s Regulation on Instant (Inter-Bank) Electronic Funds Transfer Services in Nigeria is a 2018 document that, in search summaries, treats an instant transfer as one where the funds are delivered within 60 seconds (a payment taking longer is treated as an ACH payment) and requires name enquiry support to reduce wrong credits. Press and law-firm reports say a failed transfer not reversed into the customer’s account within 24 hours of a complaint attracts a ₦10,000 fine per item, and one summary says the sending bank must refund the proceeds of a failed transaction returned by the receiving bank within 10 minutes, and one it was unable to process within one hour after the next settlement closure. The summaries add that a wrongly credited transfer is to be reversed within one business day where funds are available, and that settlement is as agreed among participants but no later than T+1, the next business dayas of 2026-11. Those may be two different clocks (one from the failure, one from the receiving bank’s return) and the summaries do not reconcile them, nor a report that gives four minutes for a late credit. Most sources give an effective date of 2 October 2018 and one entry reads 20 October, which may be a typo. This chapter could not open the regulation, so read its sections on failed transactions yourself. What you can design from, whichever number is right, is that a failed transfer has a clock on it, and a suspense balance with no ageing report has nobody watching the clock. Chapters 6.3 and 6.4 read the same summaries from the receiving side and the status-query side.

A law firm’s summary of the CBN’s Guidelines on Instant Payment Functionalities for Financial Institutions says they took effect on 1 July 2026, that a mobile banking app may be enabled on one device at a time, and that a ₦20,000 ceiling applies in the first 24 hours after activation on a new deviceas of 2026-11. Press reports date the circular to March 2026. Reports disagree on whether the ₦20,000 ceiling covers newly opened accounts, existing customers who move to a new device, or both, and on whether it limits outflows only or inflows too. This chapter did not find the circular itself, and no search result addressed what the guidelines require of a sending bank in particular. Read the circular, then write your step 1 checks from it. In the lab’s model this step is not simulated.

The third rule is the one already taught: money is the bank’s liability to the customer, and a debit that the bank cannot account for is a loss to the bank. Double entry for engineers gave the discipline. A sending bank applies it to a flow that takes a second on a good day and half an hour on a bad one.

Where it goes wrong

Name the failures first.

Sending before the debit is written. A crash between the two steps leaves money out and nothing taken. Write the debit, with the identifier, in one transaction first.

Putting the customer back on a timeout. The receiver may have been credited. The customer then has her money and the receiver has it too. Wait for a definite answer.

A suspense account no one reads. A debit with no answer sits there for days and the customer calls. Age every item and alert on the oldest.

Posting without comparing. The books balance when a fee was never posted, when the bank reverses a transfer the switch settled, and when the bank’s position differs from the switch’s. A balanced ledger proves arithmetic. Compare it with the other party’s record.

A fee that nothing recomputes. The fee is a table lookup done in one place and posted in another. The comparison of charged and due is a few lines and catches the gap.

Treating the timestamp as the truth. In the lab, the debit and the instruction have the same timestamp. A real log has an interval between them and a log entry for each. A customer who disputes a transfer needs both.

What the data cannot tell you

The lab’s bank_log is clean for Northmere’s Thursday: one row per outward transfer (a few other banks carry extra rows that later chapters examine), a status of completed or reversed, a fee and a time. It has no sign of what the real bank had to decide, such as whether a debit was refused for a limit, a PND or a balance. It has no customer who tried twice, and no screen where the customer saw “processing”. It cannot say how long the real switch gives a bank to answer, which messages carry the identifier, or what a real bank must put in front of a customer. Those are NIBSS’s specification, your sponsor’s rules, the CBN’s regulations and your own policy.

LAB Replay Northmere's Thursday, post it, and check the fees it charged ~45 MIN
YOU NEEDPython 3.9 or later (standard library only)labs/financeNo Docker, no packages, no servers

You work in labs/finance. Every step is Python from that folder against data/rails.sqlite. The sqlite3 command-line tool is not needed. B05 is Northmere Bank, and the day is Thursday 18 June 2026.

1. Generate the week and check it. About a second, with the same seed every time.

cd labs/finance
python3 rails.py
python3 check.py --rails-only
32 participants, 22,835 accounts, 17,998 transfers, 12,158 name enquiries, 136 status queries
21 settlement sessions, 125 batch files, 193 RTGS payments, 3,412 USSD sessions, 3,453 PSB postings
planted (answers/rails_truth.csv): credited_without_settlement 4, customer_fee_not_charged 6, customer_reversed_twice 3, levy_not_charged 5, mmo_trust_shortfall 1, participant_limit 4, participant_outage 1, psb_cash_out_fee_not_posted 1, psb_cash_out_posted_twice 1, reversed_after_late_success 4, same_number_two_banks 8, switch_incident 1, telco_record_missing 12
rails week: 17,998 transfers, 21 settlement sessions, 22,835 accounts; checks 21-25 run
OK: all invariants hold

The third line is the generator’s own tally of what it planted for the chapters to find. This chapter finds one kind of them, the six customer_fee_not_charged, and meets the timeouts behind two others. Do not open answers/rails_truth.csv until step 4.

2. Replay the day. For each of B05’s outward rows in bank_log on Thursday, join the switch’s transfers row and the name enquiry that came first, if the transfer has one, then check that the bank’s record and the switch’s agree.

python3 - <<'PY'
import sqlite3
from datetime import datetime

BANK, DAY = "B05", "2026-06-18"
db = sqlite3.connect("data/rails.sqlite")
db.row_factory = sqlite3.Row
t = lambda s: datetime.fromisoformat(s)

week = db.execute("""
    SELECT b.session_id, b.account_no, b.amount_kobo, b.customer_fee_kobo AS fee_charged, b.status AS bank_status,
           b.posted_at AS debit_at, b.reversed_at,
           t.name_enquiry_id, t.dest, t.first_response, t.latency_ms, t.final_status, t.final_at,
           t.customer_fee_kobo AS fee_due, n.at AS enquiry_at, n.response AS enquiry_response
    FROM bank_log b
    JOIN transfers t ON t.session_id = b.session_id
    LEFT JOIN name_enquiries n ON n.id = t.name_enquiry_id
    WHERE b.institution = ? AND b.direction = 'out'
    ORDER BY b.posted_at""", (BANK,)).fetchall()
rows = [r for r in week if r["debit_at"][:10] == DAY]

print(f"{BANK} on {DAY}: {len(rows)} outward transfers in the bank's log")
by = {}
for r in rows:
    key = (r["first_response"], r["final_status"], r["bank_status"])
    by[key] = by.get(key, 0) + 1
print("first response / switch final status / bank's own status")
for k, n in sorted(by.items()):
    print(f"   {k[0]}  {k[1]}  {k[2]:<10} {n:>4}")

def show(r):
    print(f"   {r['session_id']}  {r['amount_kobo']:>9} kobo to {r['dest']}")
    if r["enquiry_at"]:
        print(f"     name enquiry {t(r['enquiry_at']):%H:%M:%S} -> {r['enquiry_response']}")
    else:
        print("     name enquiry none of its own (saved beneficiary)")
    print(f"     debit        {t(r['debit_at']):%a %H:%M:%S}")
    print(f"     response     {r['first_response']} after {r['latency_ms']} ms; switch final status {r['final_status']} at {t(r['final_at']):%H:%M:%S}")
    print(f"     bank status  {r['bank_status']}, fee charged {r['fee_charged']} of {r['fee_due']}" +
          (f", customer put back at {t(r['reversed_at']):%H:%M:%S}" if r["reversed_at"] else ""))

def pick(pool, first, status, biggest=False):
    found = [r for r in pool if (r["first_response"], r["bank_status"]) == (first, status)]
    return max(found, key=lambda r: r["amount_kobo"]) if biggest else found[0]

print("four of them, in full (the refusal is the week's first, the rest are from the day)")
show(pick(rows, "00", "completed"))
show(pick(week, "57", "reversed"))
show(pick(rows, "97", "reversed", biggest=True))
show(pick(rows, "97", "completed"))

saved = [r for r in rows if not r["name_enquiry_id"]]
asked = [r for r in rows if r["name_enquiry_id"]]
print("checks over all", len(rows))
print("   saved beneficiary, no enquiry of its own:", len(saved))
print("   enquiry before debit, of those with one: ", sum(t(r["enquiry_at"]) < t(r["debit_at"]) for r in asked), "of", len(asked))
print("   session id starts with the bank's institution code:",
      sum(r["session_id"][:6] == db.execute("SELECT inst_code FROM participants WHERE code=?", (BANK,)).fetchone()[0] for r in rows))
print("   completed exactly when final 00:", sum((r["bank_status"] == "completed") == (r["final_status"] == "00") for r in rows))
print("   full fee when completed:     ", sum(r["fee_charged"] == r["fee_due"] for r in rows if r["bank_status"] == "completed"),
      "of", sum(r["bank_status"] == "completed" for r in rows))
print("   no fee when reversed:        ", sum(r["fee_charged"] == 0 for r in rows if r["bank_status"] == "reversed"),
      "of", sum(r["bank_status"] == "reversed" for r in rows))
tq = db.execute("""SELECT session_id, COUNT(*) FROM tsq WHERE asked_by = ? GROUP BY 1""", (BANK,)).fetchall()
asked_status = {s for s, _ in tq}
print("   timeouts with a status query on record:", sum(r["session_id"] in asked_status for r in rows if r["first_response"] == "97"),
      "of", sum(r["first_response"] == "97" for r in rows))
PY
B05 on 2026-06-18: 184 outward transfers in the bank's log
first response / switch final status / bank's own status
   00  00  completed   180
   97  00  completed     1
   97  97  reversed      3
four of them, in full (the refusal is the week's first, the rest are from the day)
   900938260618001449173632698312     769300 kobo to B17
     name enquiry 00:13:57 -> 00
     debit        Thu 00:14:49
     response     00 after 1687 ms; switch final status 00 at 00:14:49
     bank status  completed, fee charged 2500 of 2500
   900938260616123522000700680759     593300 kobo to S02
     name enquiry 12:33:28 -> 00
     debit        Tue 12:35:22
     response     57 after 460 ms; switch final status 57 at 12:35:22
     bank status  reversed, fee charged 0 of 2500, customer put back at 12:36:02
   900938260618152536943062436197    4422400 kobo to B01
     name enquiry 15:25:01 -> 00
     debit        Thu 15:25:36
     response     97 after 30000 ms; switch final status 97 at 15:52:36
     bank status  reversed, fee charged 0 of 2500, customer put back at 15:52:36
   900938260618153012998530552201    1332400 kobo to B17
     name enquiry 15:29:27 -> 00
     debit        Thu 15:30:12
     response     97 after 30000 ms; switch final status 00 at 15:34:05
     bank status  completed, fee charged 2500 of 2500
checks over all 184
   saved beneficiary, no enquiry of its own: 63
   enquiry before debit, of those with one:  121 of 121
   session id starts with the bank's institution code: 184
   completed exactly when final 00: 184
   full fee when completed:      181 of 181
   no fee when reversed:         3 of 3
   timeouts with a status query on record: 3 of 4

The bank and the switch agree on all 184 transfers: 181 completed, one of them after a timeout, and three timeouts that ended with no record at the receiving bank and were reversed. The 63 transfers with no enquiry of their own reuse a saved beneficiary’s name; every one of the other 121 had its name enquiry before its debit. Every session id begins with B05’s institution code, which shows the sender makes the identifier. Thursday has no 57, so the script takes the week’s first, on Tuesday; it is the definite no of the chapter’s table. The two timeouts show the difference in the table’s third row: the first ended 97 at 15:52:36, when the status query answered 25, and the bank put the customer back then; the second ended 00 at 15:34:05, when the status query said the receiver had been credited, and the bank kept the debit and charged the fee. The switch’s final_at for a timeout is the moment the answer was known. Three of the four timeouts have a status query on record. The fourth is the one the chapter returns to. All 181 completed transfers were charged in full on Thursday, so step 4 has nothing to find at Northmere.

3. Post the day as a ledger. The journal below has the three accounts of the chapter’s diagram. It asserts that every posting balances, shows the suspense account at four moments, lists what sat there for more than a minute, and compares the week’s postings with the switch’s settlement positions.

python3 - <<'PY'
import sqlite3
from collections import defaultdict
from datetime import datetime, timedelta

BANK, DAY = "B05", "2026-06-18"
db = sqlite3.connect("data/rails.sqlite")
t = lambda s: datetime.fromisoformat(s)

rows = db.execute("""
    SELECT b.session_id, b.account_no, b.amount_kobo, b.customer_fee_kobo, b.status, b.posted_at, b.reversed_at,
           t.latency_ms, t.first_response, t.final_at
    FROM bank_log b JOIN transfers t ON t.session_id = b.session_id
    WHERE b.institution = ? AND b.direction = 'out' AND substr(b.posted_at, 1, 10) = ?
    ORDER BY b.posted_at""", (BANK, DAY)).fetchall()

journal = []          # (when, session, account, debit_kobo, credit_kobo)
def post(when, sid, *lines):
    assert sum(d for _, d, _ in lines) == sum(c for _, _, c in lines), "unbalanced"
    for account, d, c in lines:
        journal.append((when, sid, account, d, c))

for sid, acct, amount, fee, status, debit_at, reversed_at, latency, first, final_at in rows:
    cust = f"customer:{acct}"
    d0 = t(debit_at)
    post(d0, sid, (cust, amount, 0), ("nip_suspense", 0, amount))              # money leaves the customer
    if status == "completed":
        answered = t(final_at) if first == "97" else d0 + timedelta(milliseconds=latency)   # a late yes comes with the status query
        post(answered, sid, ("nip_suspense", amount, 0), ("nip_settlement_position", 0, amount))
        if fee:
            post(answered, sid, (cust, fee, 0), ("fee_income", 0, fee))
    else:
        post(t(reversed_at), sid, ("nip_suspense", amount, 0), (cust, 0, amount))   # put back

print(f"{len(rows)} transfers, {len(journal)} journal lines")
print("every posting balanced (asserted); debits", sum(j[3] for j in journal), "credits", sum(j[4] for j in journal))
bal = defaultdict(int)
for _, _, a, d, c in journal:
    bal[a if not a.startswith("customer:") else "customers (all)"] += d - c
print("balances at the end of the day (debit positive, kobo)")
for a in ("customers (all)", "nip_suspense", "nip_settlement_position", "fee_income"):
    print(f"   {a:<26} {bal[a]:>12}")

# the suspense account through the day
def suspense_at(moment):
    at = datetime.fromisoformat(f"{DAY}T{moment}+01:00")
    return sum(c - d for when, _, a, d, c in journal if a == "nip_suspense" and when <= at)
for moment in ("09:50:00", "15:31:00", "15:40:00", "16:00:00"):
    print(f"suspense at {moment}: {suspense_at(moment):>7} kobo")
print("transfers that sat in suspense for more than 60 seconds")
first = {j[1]: j[0] for j in journal if j[2] == "nip_suspense" and j[4]}
last = {j[1]: j[0] for j in journal if j[2] == "nip_suspense" and j[3]}
for sid in first:
    held = (last[sid] - first[sid]).total_seconds()
    if held > 60:
        amt = next(j[4] for j in journal if j[1] == sid and j[2] == "nip_suspense" and j[4])
        print(f"   {sid} {amt:>8} kobo from {first[sid]:%H:%M:%S} to {last[sid]:%H:%M:%S} ({held / 60:.1f} min)")
print("seconds of suspense per transfer: median",
      sorted((last[s] - first[s]).total_seconds() for s in first)[len(first) // 2])

# the week: what the bank posted to its settlement position against the switch's own numbers
mine = dict(db.execute("""SELECT t.settlement_session, SUM(b.amount_kobo)
    FROM bank_log b JOIN transfers t ON t.session_id = b.session_id
    WHERE b.institution = ? AND b.direction = 'out' AND b.status = 'completed' GROUP BY 1""", (BANK,)).fetchall())
theirs = dict(db.execute("SELECT session, sent_kobo FROM settlement_positions WHERE participant = ?", (BANK,)).fetchall())
diff = {s: (mine.get(s, 0), theirs.get(s, 0)) for s in set(mine) | set(theirs) if mine.get(s, 0) != theirs.get(s, 0)}
print(f"week: {len(theirs)} sessions with a B05 position; the bank's own count of money sent differs in {len(diff)}")
print("sent in the week:", sum(mine.values()), "kobo by the bank;", sum(theirs.values()), "kobo by the switch")
PY
184 transfers, 1098 journal lines
every posting balanced (asserted); debits 670714800 credits 670714800
balances at the end of the day (debit positive, kobo)
   customers (all)               330124300
   nip_suspense                          0
   nip_settlement_position      -329733300
   fee_income                      -391000
suspense at 09:50:00:  240400 kobo
suspense at 15:31:00: 5754800 kobo
suspense at 15:40:00: 4422400 kobo
suspense at 16:00:00:       0 kobo
transfers that sat in suspense for more than 60 seconds
   900938260618093628085822486076   240400 kobo from 09:36:28 to 10:05:19 (28.9 min)
   900938260618152536943062436197  4422400 kobo from 15:25:36 to 15:52:36 (27.0 min)
   900938260618153012998530552201  1332400 kobo from 15:30:12 to 15:34:05 (3.9 min)
seconds of suspense per transfer: median 1.013
week: 21 sessions with a B05 position; the bank's own count of money sent differs in 0
sent in the week: 1738855600 kobo by the bank; 1738855600 kobo by the switch

The working: 330,124,300 = 329,733,300 sent plus 391,000 in fees, so the customers paid for exactly what the bank sent, and the signs are the debit-positive convention (the position and the income are credits, so they are negative). Suspense ends at zero. At 15:31 it holds 4,422,400 + 1,332,400 = 5,754,800 kobo, ₦57,548: two customers’ money, in neither bank. By 15:40 the second has completed, at the status query that said 00, and 4,422,400 remains until the first is put back at 15:52:36. At 16:00 the account is empty. The median stay of 1.013 seconds is the Predict’s answer, and the three long stays are the three timeouts that were queried. The 4 minutes of the third is a late yes: the bank posts it to the settlement position when the query answers, not when it timed out. In the week the bank’s own count of money sent equals the switch’s sent figure in all 21 sessions with a B05 position. Fee income is 391,000, equal to the fees due on the 181 completed transfers, so nothing was missed.

4. Find the fees that were not charged. The script computes the fee due from the amount with the lab’s table and compares it with what each bank’s log charged, Northmere’s included. It opens the answer key only at the end.

python3 - <<'PY'
import csv, sqlite3

db = sqlite3.connect("data/rails.sqlite")
NAIRA = 100

def fee_due(amount_kobo):                 # the lab's illustrative tiers, not the CBN's table
    if amount_kobo <= 5_000 * NAIRA:
        return 10 * NAIRA
    return 25 * NAIRA if amount_kobo <= 50_000 * NAIRA else 50 * NAIRA

n_bad = sum(fee_due(a) != f for a, f in db.execute("SELECT amount_kobo, customer_fee_kobo FROM transfers"))
print(f"1. the table agrees with the transfers' fee column on all but {n_bad} of "
      f"{db.execute('SELECT COUNT(*) FROM transfers').fetchone()[0]:,}")

rows = db.execute("""
    SELECT b.institution, b.session_id, b.posted_at, b.amount_kobo, b.customer_fee_kobo
    FROM bank_log b JOIN transfers t ON t.session_id = b.session_id
    WHERE b.direction = 'out' AND t.final_status = '00' AND b.status = 'completed'
    ORDER BY b.institution, b.posted_at""").fetchall()
short = [(i, s, at, a, fee_due(a), f) for i, s, at, a, f in rows if f != fee_due(a)]
print(f"2. completed outward transfers charged less than the fee due: {len(short)} of {len(rows):,}")
for i, s, at, a, due, f in short:
    print(f"   {i}  {at[:16]}  amount {a:>8}  due {due:>5}  charged {f}  short {due - f}")
by = {}
for i, *_, due, f in short:
    by[i] = by.get(i, 0) + due - f
print("3. by bank, kobo not collected: " + ", ".join(f"{i} {k}" for i, k in sorted(by.items())))
b05 = db.execute("SELECT COUNT(*), SUM(customer_fee_kobo) FROM bank_log WHERE institution='B05' AND direction='out' AND status='completed'").fetchone()
print(f"4. B05 collected {b05[1]} kobo in fees on {b05[0]:,} completed transfers in the week; it missed {by.get('B05', 0)}")

print("5. the answer key")
for r in csv.DictReader(open("data/answers/rails_truth.csv")):
    if r["kind"] == "customer_fee_not_charged":
        print(f"   {r['who']}  {r['ref']}  {r['amount_kobo']}")
found = {s for _, s, *_ in short}
key = {r["ref"] for r in csv.DictReader(open("data/answers/rails_truth.csv")) if r["kind"] == "customer_fee_not_charged"}
print("   found", len(found & key), "of", len(key), "planted; extra", len(found - key))
PY
1. the table agrees with the transfers' fee column on all but 0 of 17,998
2. completed outward transfers charged less than the fee due: 6 of 17,794
   B01  2026-06-15T15:17  amount   790800  due  2500  charged 0  short 2500
   B01  2026-06-20T09:23  amount 11914100  due  5000  charged 0  short 5000
   B06  2026-06-18T17:57  amount   532100  due  2500  charged 0  short 2500
   B09  2026-06-15T13:35  amount   263600  due  1000  charged 0  short 1000
   B10  2026-06-15T08:05  amount   617700  due  2500  charged 0  short 2500
   S02  2026-06-20T20:26  amount  1395800  due  2500  charged 0  short 2500
3. by bank, kobo not collected: B01 7500, B06 2500, B09 1000, B10 2500, S02 2500
4. B05 collected 2156000 kobo in fees on 1,013 completed transfers in the week; it missed 0
5. the answer key
   S02  900905260620202622908964314350  2500
   B06  900904260618175758519235039062  2500
   B01  900824260620092313251215628637  5000
   B09  900984260615133524968911589422  1000
   B01  900824260615151739839048909675  2500
   B10  900846260615080551795933723346  2500
   found 6 of 6 planted; extra 0

Six of 17,794 completed transfers carried no fee, at five banks: two at B01 (₦25 on Monday and ₦50 on Saturday) and one each at B06, B09, B10 and S02, ₦160 in all (16,000 kobo). None is Northmere’s: its 1,013 completed transfers collected ₦21,560 over the week and missed nothing, so the control runs clean there and says so with a zero. All six are in the key and nothing else is flagged. The table agrees with every transfer’s fee column because the lab’s generator uses one function for both, so the control here finds a bank that did not post, and it cannot find a table that is wrong: a real fee table needs its own check against the CBN’s guide.

5. Write a sending bank. Save this as work/sending_bank.py. It debits first, records it, sends through a stub switch that answers as scripted, keeps a timed-out transfer in suspense, and resolves it only on a status query. The scripted transfers are A (yes), B (a definite no), C (a timeout that the query says never reached the receiver) and D (a timeout that the query says was credited).

mkdir -p work
cat > work/sending_bank.py <<'PY'
from collections import defaultdict

REVERSE_ON_TIMEOUT = False        # the break at the end of the lab turns this on
NAIRA = 100

def fee_due(amount):              # the lab's illustrative fee table
    return 10 * NAIRA if amount <= 5_000 * NAIRA else 25 * NAIRA if amount <= 50_000 * NAIRA else 50 * NAIRA

class SwitchStub:
    """Answers as scripted. The second value is what the status query says once the first answer was a timeout."""
    def __init__(self, script):
        self.script = script
    def transfer(self, ref):
        first, _ = self.script[ref]
        if first == "97":
            raise TimeoutError("no answer in 30 s")
        return first
    def requery(self, ref):
        return self.script[ref][1]

class SendingBank:
    def __init__(self, switch, opening):
        self.switch, self.balances, self.state = switch, dict(opening), {}
        self.entries = defaultdict(int)             # account -> credit minus debit, kobo
        self.sent_to_switch = 0                     # what the settlement position says we owe
        self.open = {}                              # reference -> (account, amount)

    def post(self, *lines):                         # (account, debit, credit); must balance
        assert sum(d for _, d, _ in lines) == sum(c for _, _, c in lines)
        for account, d, c in lines:
            self.entries[account] += c - d

    def send(self, ref, account, amount):
        need = amount + fee_due(amount)
        if self.balances[account] < need:
            self.state[ref] = "refused: insufficient funds"
            return
        self.balances[account] -= amount            # 1. debit first, and record that we did
        self.post((f"customer:{account}", amount, 0), ("nip_suspense", 0, amount))
        self.open[ref] = (account, amount)
        self.state[ref] = "debited"
        try:
            code = self.switch.transfer(ref)        # 2. only then send
        except TimeoutError:
            self.state[ref] = "unknown"             # 3. no answer is not a no
            if REVERSE_ON_TIMEOUT:
                self.reverse(ref)
            return
        self.complete(ref) if code == "00" else self.reverse(ref)

    def complete(self, ref):
        account, amount = self.open.pop(ref)
        fee = fee_due(amount)
        self.balances[account] -= fee
        self.post(("nip_suspense", amount, 0), ("nip_settlement_position", 0, amount),
                  (f"customer:{account}", fee, 0), ("fee_income", 0, fee))
        self.sent_to_switch += amount
        self.state[ref] = "completed"

    def reverse(self, ref):
        account, amount = self.open.pop(ref)
        self.balances[account] += amount
        self.post(("nip_suspense", amount, 0), (f"customer:{account}", 0, amount))
        self.state[ref] = "reversed"

    def resolve_unknowns(self):
        for ref in [r for r, s in self.state.items() if s == "unknown"]:
            answer = self.switch.requery(ref)       # 00 credited, 25 no record
            self.complete(ref) if answer == "00" else self.reverse(ref)

    def show(self, label):
        print(f"{label}: customer {self.balances['9396820852']:>7}  suspense {self.entries['nip_suspense']:>7}  "
              f"position {self.entries['nip_settlement_position']:>7}  fees {self.entries['fee_income']:>5}")

script = {"A": ("00", None), "B": ("57", None), "C": ("97", "25"), "D": ("97", "00")}
bank = SendingBank(SwitchStub(script), {"9396820852": 1_000_000})
bank.show("opening           ")
for ref, amount in (("A", 100_000), ("B", 200_000), ("C", 300_000), ("D", 150_000)):
    bank.send(ref, "9396820852", amount)
    bank.show(f"after {ref} ({bank.state[ref]:<9})")
bank.resolve_unknowns()
bank.show("after the requeries")
print({r: s for r, s in bank.state.items()})
total = bank.balances["9396820852"] + bank.entries["nip_suspense"] + bank.entries["nip_settlement_position"] + bank.entries["fee_income"]
print("customer + suspense + position + fees =", total, "(opening 1000000)")
switch_says = sum(a for r, a in (("A", 100_000), ("B", 200_000), ("C", 300_000), ("D", 150_000))
                  if script[r][0] == "00" or script[r][1] == "00")
print(f"the switch will settle {switch_says} kobo sent; the bank's position holds {bank.sent_to_switch}")
PY
python3 work/sending_bank.py
opening           : customer 1000000  suspense       0  position       0  fees     0
after A (completed): customer  899000  suspense       0  position  100000  fees  1000
after B (reversed ): customer  899000  suspense       0  position  100000  fees  1000
after C (unknown  ): customer  599000  suspense  300000  position  100000  fees  1000
after D (unknown  ): customer  449000  suspense  450000  position  100000  fees  1000
after the requeries: customer  748000  suspense       0  position  250000  fees  2000
{'A': 'completed', 'B': 'reversed', 'C': 'reversed', 'D': 'completed'}
customer + suspense + position + fees = 1000000 (opening 1000000)
the switch will settle 250000 kobo sent; the bank's position holds 250000

The customer starts with ₦10,000. A costs ₦1,000 and a ₦10 fee, so 1,000,000 − 100,000 − 1,000 = 899,000. B is debited and put back, so nothing changes. C and D time out: the customer is down 300,000 + 150,000 more, 899,000 − 450,000 = 449,000, and suspense holds exactly that, 450,000. The status queries say C was never credited and D was, so C goes back and D completes with its fee: 449,000 + 300,000 − 1,000 = 748,000. The money is conserved: 748,000 + 250,000 + 2,000 = 1,000,000. The bank’s position, 250,000, equals what the switch will settle, A plus D.

Set REVERSE_ON_TIMEOUT = True on the third line of work/sending_bank.py and run it again. The bank now treats every timeout as a no. C is put back, which is right, and D is put back too, which is wrong: the switch says D was credited. The run ends with the customer at 899,000 kobo instead of 748,000 (she keeps the ₦1,500 and the ₦10 fee she never paid), suspense at zero, and the last line reads the switch will settle 250000 kobo sent; the bank's position holds 100000. The conservation line still prints 1000000, because every posting balanced. Nothing inside the bank’s own ledger is wrong. Only the comparison with the switch’s record finds the 150,000 kobo the bank owes and has already paid out to its own customer. That is the shape of the four reversed_after_late_success transfers in the lab’s week. Chapter 6.4 follows them through the real data; ask here how long the bank would take to notice if it compared its position with the switch’s only at the end of the month.

ARTEFACT Write the daily suspense review ~45 MIN
YOU PRODUCEA daily outward-transfers suspense review

Template

# Outward-transfers suspense review: <bank>, <date>
Prepared by <analyst>, payments operations. Signed by <head of payments operations>.

## 1. Balance
- nip_suspense at close: <kobo> (₦<amount>)
- Should be (open items in the bank's log at close): <kobo>
- Difference: <kobo>, and what explains it
- Balance at <the time the trouble started>: <kobo> (₦<amount>)

## 2. Open items (anything that sat in suspense more than <n> seconds)
| Session | Amount | Debited | Age | Cause | Status query | Cleared (by whom, when), or owner if open |

## 3. Fees not charged
Fee charged vs fee due on every completed transfer: <count> short, <kobo> in all. List each, or write "none".

## 4. Postings proposed
| Item | Debit account | Credit account | Kobo | Why |
Postings already made today are listed separately.

## 5. How this could be wrong
<one way, and what would show it>

## 6. Decision and sign-off
Decision needed: <what, from whom, by when>. Out of scope: <what this review does not cover>.
Prepared <name, date>. Approved <name, date>.
WORKED EXAMPLE

A payments operations analyst on Fatai’s team writes this each evening; Fatai, head of payments operations at Northmere, signs it. This is Thursday 18 June 2026, from the lab’s B05 figures.

Balance. nip_suspense at close: 0 kobo. Should be: 0, because all 184 outward transfers are completed or reversed in the bank’s log. Difference: 0. At 15:31, when the switch was degraded, it held 5,754,800 kobo (₦57,548), two customers’ money.

Open items. All four timeouts are cleared, so none is open at close.

Session ends Amount Debited Age Cause Query Cleared
…486076 ₦2,404 09:36:28 28.9 min timeout 25 at 10:05:19 bank, reversed 10:05:19
…258865 ₦7,658 12:35:33 40 s timeout none on record bank, reversed 12:36:13
…436197 ₦44,224 15:25:36 27.0 min timeout, switch degraded 25 at 15:52:36 bank, reversed 15:52:36
…552201 ₦13,324 15:30:12 3.9 min timeout, switch degraded 00 at 15:34:05 bank, completed 15:34:05, ₦25 fee

Fees. Charged 391,000 kobo; due on the 181 completed transfers 391,000. None short.

Postings. None proposed. The four above were posted today and each balanced.

Could be wrong. The close is replayed from the bank’s log, not read from the general ledger. A ledger balance other than 0 would show it. The ₦7,658 item was put back with no status query, so it is right only because no credit followed.

Decision. Fatai is asked to approve the day and to have a status query sent on the ₦7,658 transfer to B12, which was put back without one. Rules and other banks’ items are out of scope.

Now you

You are the payments operations analyst at B01, a partner bank on the same switch as Northmere, and your head of payments operations signs what you write. Write B01’s suspense review for Thursday 18 June 2026. Run the lab’s step 2 and step 3 scripts with BANK = "B01"; they print the transfers, the suspense balance at four moments and every stay over 60 seconds. Check the switch’s outages table for the day, filter step 4’s list to B01 and that Thursday, and look in tsq for the status queries B01 asked. A balance above zero at one moment is not always a fault: say which of yours are. Decide what each item’s cause was, which items had a query before they were cleared, and which postings, if any, you would propose. Your head of payments operations reads the review to decide whether any item needs a call to the switch or a posting before tomorrow’s opening.

Self-check

DECIDE

Northmere's daily fee check is clean for the week, but B01, a partner bank on the same switch, runs the same comparison and lists two completed transfers with no fee charged, ₦75 in all, one on Monday and one on Saturday. B01's payments lead asks Fatai what a bank in that position should do. The fix would need a change to the fee-posting job and some weeks of testing. The cause is not yet known, and neither customer has complained.

READING
  1. DOC
    Regulation on Instant (Inter-Bank) Electronic Funds Transfer Services in Nigeria (CBN, 2018) Central Bank of Nigeria, 2018

    The regulator's text on the 60-second rule, name enquiry and failed transfers. Read the duties of the sending institution and the clause on reversals, because the summaries give different times. Skip the sections on licensing. This chapter rests on search summaries of it, so check each figure.

  2. DOC
    Guide to Charges by Banks, Other Financial and Non-Bank Financial Institutions (CBN, effective 1 January 2020) Central Bank of Nigeria, 2020

    The regulator's own guide behind the transfer-fee bands. Read the electronic-transfer section for the bands and their boundaries, and who may charge them. It is the 2020 text, so check whether a newer guide has replaced it. This chapter rests on summaries of it.

  3. DOC
    What is NIP service? (NIBSS support article) NIBSS

    The scheme operator's own description of NIP, with the sending and receiving institution roles and the services it offers. Read it first, then the sponsor bank's technical specification, which is where session ids and response codes are defined. Short.

  4. DOC
    How does Settlement happen on the service? (NIBSS support article) NIBSS

    NIBSS's wording on deferred net settlement and funds available before settlement. Read it to see why the sending bank's settlement position is a separate account from suspense. Check which service the article covers before you quote it.

  5. POST
    Device Binding and Transaction Caps: The CBN's Instant Payment Guidelines Take Effect (law-firm summary) SCP Law, 2026

    A law firm's reading of the 2026 Guidelines on Instant Payment Functionalities: device binding and the first-24-hours cap. A secondary source: use it to learn what to look for, then read the CBN circular it describes, because reports differ on the cap's scope.

  6. POST
    Books, an immutable double-entry accounting database service (Square engineering blog) Square, 2019

    A payments company's account of why it built its ledger as immutable double entry: each balance is the sum of its changes, and every change is a transaction that states why. Read it for how a ledger with in-transit accounts is argued for. A vendor's design, and its present status is unconfirmed.

All companies and people in these examples are fictional. Any resemblance to a real business or person is unintended.

RECALL CARDS Tap to flip. They join your review deck when you mark the lesson complete.
NEXT: The receiving bank's side: crediting, refusing and frozen accounts →