PRINCIPALAICHAPTER 41

Who is liable when an AI moves money: authorisation, consent and the rules not yet written

The loss rules for payments were written for a person who taps pay. Run three payments from an agent's logs through them, and the list of questions no rule answers is the finding

60 MINPAYMENTSUPDATED 2026-11-14
PREDICT

A customer's agent pays ₦12,500 for a school bag, to the shop and under the limits the customer signed on the mandate screen. The next day the customer regrets it. Which of these rules gives the customer a refund as an unauthorised transaction?

The question the rules were not written for

The loss rules for payments divide into two boxes. In the first, the payer (the person whose money it is) authorised the payment: gave consent in the form the rules accept. The payer bears the loss, because the payer chose it, and any remedy is against whoever took the money. In the second, the payment was unauthorised: someone else moved the money without the payer’s consent. The payer’s payment service provider (the PSP: the bank, card issuer or wallet that holds the payer’s account) carries most or all of the loss, and the payer’s share is capped by statute.

Everything is decided by which box a payment lands in. The rules put it there by asking who consented, to what, in what form. That works for a card tap, a PIN, a one-time code. It assumes one human who either did or did not do the thing.

An agent breaks the assumption in three places. The customer consented to a task, not to this payment. The payment is started by software that read text from strangers (the earlier chapter built the control around that fact). And the limits the customer set sit in the agent operator’s system, where the PSP cannot see them. The operator is the startup, which is not the payer and, depending on its licence (licences in Nigeria), may not be a PSP either. None of the four regimes below was written with that party in mind.

Three cases from the agent’s logs

The lab builds the agent and gate from the previous chapter and runs three cases against it. The payer is customer C0000001; the shops are merchants in the generated data. Every figure below is from the lab’s own output.

Case What happened What the books say
1. Regret inside the mandate The agent buys the ₦12,500 blue bag from C0000030 under mandate M-0001 (₦15,000 a payment, ₦100,000 in all). The customer later says they meant something else. AG-1001 succeeded, mandate id on the row, charge at the provider.
2. Injection outside the mandate A listing’s text tells a credulous agent to pay 480,000 naira to its own seller C0000048. Run twice: behind the gate, and as a twin where the agent holds the card and the limits are only in its prompt. Gated, AG-1003 is refused with three codes and no charge exists. Twin, UG-1003 succeeded for ₦480,000 with mandate id none.
3. Mistaken payee The customer meant school C0000042 but typed C0000044 on the mandate screen. Mandate M-0002 allows ₦45,000 to C0000044. The agent pays it. BILL-3001 succeeded: ₦45,000 sits in the wrong merchant’s wallet, under a mandate the customer signed.

Cases 1 and 3 have an honest agent and a gate that works. Case 2 is the control working, and then the control missing. A fourth payment appears in step 5 of the lab: the within-mandate injection from the previous chapter, a ₦14,900 bag chosen because a listing said to, which the gate approved. It is not one of the three cases and it matters for the gap list.

Test one: was it authorised?

The regimes define the line in different words.

US Regulation E, which governs consumer electronic fund transfers, defines an unauthorised transfer in 12 CFR 1005.2(m) by four elements (search summaries of the eCFR text): the transfer comes from the consumer’s account, it is initiated by someone other than the consumer, that person has no actual authority, and the consumer receives no benefit from it. It excludes transfers by a person the consumer furnished the access device to, unless the consumer has told the institution that person’s transfers are no longer authorised; transfers made with fraudulent intent by the consumer or someone acting with them; and transfers made by the institution or its employeeas of 2026-11. The official commentary on the line is the difficult part. Summaries of the official staff commentary (the Federal Reserve Regulatory Service hosts a copy) say that where a consumer furnishes an access device and grants actual authority to another person, that person’s transfers are not unauthorised until the consumer notifies the institution, and that a transfer by someone who obtained the device from the consumer through fraud or robbery is unauthorisedas of 2026-11. Read in plain words: if you hand over the card and the authority, the bank may treat what the holder does as yours, even when the holder exceeds what you meant. I did not read the commentary text itself, only these summaries, and the current official interpretations are the CFPB’s.

The UK Payment Services Regulations 2017 (the PSRs), regulation 67, treat a payment as authorised only if the payer has given consent, which can be given before execution or, if the payer and the PSP agree, afteras of 2026-11. PSD2, the EU’s second Payment Services Directive, Article 64 is the EU source of the same idea: a transaction is authorised only if the payer consented, and without consent it is unauthorised; consent may be given through the payee or a payment initiation service provider, and withdrawn up to the point of irrevocabilityas of 2026-11. Neither text, in the search results, says whether a standing mandate with limits is consent to each payment made inside it, or whether a payment outside the limits is something the payer consented to by delegating to the agent.

The Central Bank of Nigeria’s (CBN) Consumer Protection Regulations 2019 are on the CBN’s site, issued in December 2019 on top of its 2016 framework, and search summaries say they cover complaints handling and redress; the results did not show their text on unauthorised debits or refundsas of 2026-11. A law-review article in the same results quotes a rule that an institution making an unauthorised debit must show clear legal authority on written notice or reverse it within 72 hours, but attributes it to the CBN’s consumer protection framework, so I could not confirm that wording in the 2019 regulations. A CBN exposure draft of revised regulations (Consumer Protection Regulations 2.0), dated December 2023 in the results, is on the CBN’s site; I found no notice that it was finalised, so the 2019 text is the one to read first and its status is to be confirmed on the CBN’s own pagesas of 2026-11. So the refund duty in the table below is unconfirmed: it rests on a summary, not on a clause I read.

Test two: what does the payer lose if it was not authorised?

When a payment lands in the unauthorised box, the regimes cap the payer’s share. The figures differ, and so do the conditions.

Regulation E, 12 CFR 1005.6, as summarised in the results, has three tiers: a consumer who reports a lost or stolen access device within two business days is liable for the lesser of $50 or the unauthorised transfers before notice; later, but within 60 days of the periodic statement, up to $500; and after 60 days without notice, the consumer can be exposed to the transfers after the 60 days that timely notice would have prevented. The official commentary says a consumer’s negligence cannot be used to impose greater liability than the regulation allowsas of 2026-11. UK regulation 77(1) lets a PSP that is liable under regulation 76(1) require the payer to bear up to £35 of the loss. Law-firm commentary in the results says paragraph (3) makes the payer liable for all the loss where the payer acted fraudulently or, intentionally or with gross negligence, failed to meet its duties under regulation 72, and paragraph (4) removes liability for losses after the payer notifies the PSP, unless the payer was fraudulent; the same commentary suggests the £35 rule applies where the loss comes from a lost, stolen or misappropriated payment instrumentas of 2026-11. I did not read paragraphs (2) to (4) themselves, so treat that as commentary. Regulation 76(1) requires the PSP, subject to regulations 74 and 75, to refund an executed payment that was not authorised under regulation 67as of 2026-11; regulation 75 deals with evidence on authentication and execution when the user denies having authorised a paymentas of 2026-11, and a commentary in the results says recorded use of a payment instrument does not, by itself, establish that the payer authorised it.

Under PSD2, search summaries of Article 73 say the payer’s PSP must refund an unauthorised payment immediately and no later than the end of the next business day, except where it has reasonable grounds to suspect fraud by the payer and tells the national authority in writing; and of Article 74 that the payer may bear up to €50 where the conditions are met, while the payer bears all losses where it acted fraudulently or, with intent or gross negligence, failed its duties under Article 69as of 2026-11. The Article 73 timing rests on those summaries; read the Directive for the exact text. Law-firm commentary reports a 2026 ruling of the Court of Justice of the EU (Case C-70/25) that gross negligence is no ground to withhold the Article 73 refund: the PSP refunds first and argues negligence afterwardsas of 2026-11. I did not read the judgment. The European Banking Authority’s Q&A 2018_4042 concerns Article 74(2), under which, in the results’ summary, a payer whose PSP did not require strong customer authentication bears no loss unless it acted fraudulentlyas of 2026-11. Strong customer authentication, the second-proof duty, is the subject of authenticating the payer, and here it decides where the loss goes: a payment started with no second proof by the agent leaves the PSP exposed.

The Nigerian figures are the weakest. I did not find a confirmed customer-liability cap in the CBN texts. The 72-hour reversal rule above is the closest, and it is unconfirmed.

Test three: is it a scam the payer was deceived into?

A third box sits between the first two. In an authorised push payment (APP) scam, the payer did consent, but was deceived into paying the wrong person or for the wrong purpose. The UK Payment Systems Regulator’s (PSR) mandatory reimbursement requirement for APP scams on Faster Payments, with a maximum of £85,000 per claim, applies from 7 October 2024 according to the PSR’s decision and search summaries; the Bank of England as operator of CHAPS, the UK’s high-value payment system, set the same maximumas of 2026-11. The PSR’s consolidated policy statement PS25/5 of May 2025 treats an APP scam as one in which the victim is manipulated into a voluntary transfer, either to an unintended recipient or for an unintended purposeas of 2026-11. The PSR’s civil-dispute guidance, per the results, uses the absence of any intent to defraud as one marker of a civil dispute rather than a scamas of 2026-11. Note the rail: the requirement is for Faster Payments and CHAPS, bank transfers. The lab’s gate pays by card, and a card payment is not in what these results describe.

Nigeria has a draft in the same space. The CBN’s exposure draft of Guidelines for Handling Authorised Push Payment Fraud, dated late November 2025 in the results, is on the CBN’s site. The PDF text in the search results was garbled, so what follows rests on press and law-firm summaries of it: a victim induced into authorising a transfer must report within 72 hours or may lose the right to reimbursement (one outlet says 24 hours); investigations take 14 working days (some reports say 14 days); reimbursement follows 48 hours after the investigation, or the decision (reports differ); and where neither bank is at fault the two share the reimbursement equallyas of 2026-11. It is a draft and I did not establish whether a final version exists. Read the CBN’s page before you rely on any of it.

Two features matter for agents. These schemes protect a deceived payer. In case 2 the deceived party is the agent, not the customer; the customer was never asked anything. And an honest slip, as in case 3, is not deception.

The answers, case by case

This table is my reading of the texts above. Where a cell says “contested”, the text read does not decide it. None of it is advice.

US Regulation E UK PSRs 2017 and PSR APP EU PSD2 CBN rules
1. Regret inside the mandate Authorised: the agent had actual authority. Customer bears it. Authorised (reg 67). Not an APP scam: no deception. Customer bears it. Authorised (Art 64). Customer bears it. Not an unauthorised debit on the results read. Customer bears it.
2a. Injection, gate on No money moved. No loss. Same. Same. Same.
2b. Injection, agent holds the card Contested: if the agent counts as a person furnished with the card and actual authority, the transfer may fall outside the definition and the customer bears it; if the stranger’s text makes it fraud on the customer, the tiers apply. Unauthorised if the customer consented to nothing of the kind: the PSP refunds under reg 76 and the payer’s share is capped at £35 on the face of reg 77(1). Whether handing over the card is gross negligence, which commentary says lifts the cap, is untested. Unauthorised: Art 73 refund. If the PSP applied no strong authentication, Art 74(2) leaves the loss with the PSP unless the payer was fraudulent. Gross negligence is uncapped at the allocation stage (Art 74), though commentary on a 2026 EU court ruling says the PSP still refunds first; whether delegating to an agent is gross negligence is untested. Unauthorised debit: a refund duty is described in summaries but I did not confirm it in the text; a 72-hour reversal only if that rule is confirmed. Draft APP guidelines do not fit: nobody induced the customer.
3. Mistaken payee Authorised by the consumer. Not an unauthorised transfer. Error-resolution rules in Part 1005 were not searched; read them. Authorised (reg 67). Not an APP scam: a typing slip is not deception. Customer bears it, and recovery depends on the payee. Authorised (Art 64). Rules on incorrect unique identifiers were not searched; read them. Authorised. Draft APP guidelines cover induced transfers, which a slip is not. Recovery depends on the payee’s consent.

Three things stand out. Case 1 is the same everywhere, and the customer loses: the regimes agree because they all ask the same question and the answer is yes. Case 2b differs most, and it differs because the deployment lacked a gate. The twin is the unsafe design, and it is also the design in which the rules most likely send the loss to the PSP, which will not accept the loss quietly: expect it to dispute the payment back through the merchant and the operator, under the scheme rules in disputes and chargebacks and the contract. Case 3 is the most ordinary and the one nobody’s rules help with.

On the texts read, none of the four allocates any loss to the agent’s operator. It is not the payer and, if it is not a PSP, not the one the rules bind. If it bears the loss it is because of a contract, a licence condition or a court. That is the first gap.

The gap list

The gap list is the result of the exercise. Each item is a question the logs, the facts and the cases make you ask, and for each I say what the sources read here do or do not show.

  1. Is a mandate consent? Every test asks whether the payer consented. None of the texts read says whether a standing mandate with limits is consent to each payment inside it, or whether the customer’s approval of a task is consent to a payment the agent chose. Case 1 assumes yes.
  2. Is an agent a person? Regulation E’s test is whether someone other than the consumer initiated the transfer with no actual authority. Whether software acting on a customer’s instruction is “someone” in that sense, or the customer’s own instrument, is not decided in the results.
  3. Who sees the limits? The mandate is in the operator’s gate. The PSP sees a payment on a credential the customer handed over, so a payment outside the mandate looks authorised to the party the loss rules bind. Case 2b depends on it.
  4. Is handing an agent a credential negligent? The commentary summaries and PSD2’s gross-negligence carve-out both turn on what the customer did with the credential. Agent tokens from the schemes in the previous chapter may change that; their status in Nigeria was not established.
  5. Where is the operator in the rules? Not as the payer, not as an issuer. Possibly a payment initiation service provider, an agent of a licensed institution, or nothing the rules name. The licence analysis is in licences in Nigeria. The loss falls where the contract puts it.
  6. Whose deception is it? The APP schemes protect a deceived payer. When the stranger deceives the agent (case 2, and the within-mandate ₦14,900 variant), the payer was not deceived and the payment may be inside the limits. The result: no scheme, no refund right, and a customer overcharged by ₦2,400 in step 5 of the lab.
  7. Who owns a mistake on the mandate screen? Case 3. The customer’s slip is recorded as consent. A name check before signing, like the name enquiry in Nigeria’s rails, is the control, and whether the operator or the PSP must offer one is not in any text read.
  8. Which rail? The UK reimbursement scheme covers bank transfers on two named rails, not cards. Regulation E is for consumer electronic fund transfers, and I did not search how it treats credit card payments. An agent that pays by card, by transfer and by direct debit may land in three regimes for one customer.
  9. When does the clock start? Regulation E’s tiers and Nigeria’s draft 72 hours run from notice or a statement. An agent making forty small payments a month may produce a statement the customer never reads. Whether the customer knew an agent paid is itself unrecorded.
  10. What does the log prove? In the lab, the evidence audit finds 6 of 8 questions the books cannot answer: no mandate signing time, no authentication record, no agent identity or version, no request text, no record of what the agent read, no notice date. UK regulation 75 is about evidence on authentication and execution. What evidence of the customer’s intent looks like when an agent acts is not said in any text read.
  11. Nigeria has no agent rule. My searches for this chapter found no CBN circular on AI agents and payments. The closest results concerned other subjects. Status of the consumer protection revision and the APP draft is unconfirmed above.
  12. The AI Act allocates duties, not losses. The EU AI Act is Regulation (EU) 2024/1689; EUR-Lex lists a consolidated version of 27 July 2026 reflecting an amendment, Regulation (EU) 2026/1744, which law-firm commentary calls the Digital Omnibus on AI and dates to the Official Journal of 24 July 2026. Those secondary sources say it moved the application of the Annex III high-risk obligations to 2 December 2027, and that Annex III’s credit-scoring entry excepts systems used to detect financial fraud. I did not read the Official Journal text of the amendmentas of 2026-11. Nothing in the results makes an AI system’s deployer refund a payer. Law-firm commentary reports that the Commission withdrew its proposed AI Liability Directive in 2025 and that the revised Product Liability Directive treats software as a productas of 2026-11. Those are law-firm summaries, not the texts, and I did not confirm the Product Liability Directive’s application date.

What the operator can do while the rules are silent

Because the rules do not allocate the loss, the contract does. Four moves follow from the cases, none of them legal advice.

Write the loss rule down. Say, in the customer terms, who bears a payment inside the mandate (the customer), outside it (you) and on a mistaken payee (a recovery effort, and who pays for it). Customers read a refund promise as a refund promise.

Make the gate the evidence. The gated version of case 2 gives you a refused attempt with codes. The twin gives you nothing. Add the six missing facts from the audit to the log: signing time, authentication method, agent id and version, request text, an input reference, and the notice date.

Move the check to the mandate screen. Case 3 was lost at signing. Show the payee’s resolved name, in words, next to the amount, before the customer proves it is them.

Keep the PSP in the loop. If your partner bank cannot see your limits, tell it, so that a payment outside them is a payment it can query. How is a conversation with that bank, and a lawyer.

LAB Run three payments from an agent's logs through the loss rules, and audit the evidence ~60 MIN
YOU NEEDPython 3.9 or later (standard library only)labs/finance generated at seed 42, scale 0.1 (python3 generate.py)The agent/ folder from the agentic-payments lab: store.py, mandate.py, naira.py, catalogue.py, agent.py, gate.py, report.pycurlFour terminals: provider, switch, gate, and your commandsNo Docker, no packages, no model, no paid account

You work in labs/finance. This lab reuses the agent and the mandate gate from the previous chapter’s lab; if you do not have its agent/ folder, build steps 2 to 4 of that lab first (store.py, mandate.py, gate.py, naira.py, catalogue.py, agent.py). Everything new goes in agent/ and is standard library only. The sqlite3 command-line tool may not be installed, so the scripts use Python’s sqlite3 module. Every command below was run, and the outputs are what they printed (on private ports, replaced here by the defaults). The mandates, refusal codes and the card are the lab’s own and are not any provider’s, scheme’s or the CBN’s. The legal analysis in step 6 is yours.

1. Start the services and make the books. In terminal 1 start the provider, in terminal 2 the switch, in terminal 3 the gate with its clock fixed. Then, in terminal 4, reset the agent’s books and create two mandates: M-0001 for the school-bag shop and M-0002 for the ₦45,000 school fee, whose payee is the slip in case 3.

# terminal 1
python3 mock_provider.py --fresh --quiet
# terminal 2
python3 mock_switch.py --fresh --quiet
# terminal 3
python3 agent/gate.py --now 2026-11-18T10:00:00+01:00
# terminal 4
python3 agent/store.py
python3 agent/mandate.py create --payer C0000001 --payee C0000030 --purpose school_supplies --max 1500000 --budget 10000000 --valid-from 2026-11-17T00:00:00+01:00 --expires 2026-11-24T00:00:00+01:00
python3 agent/mandate.py create --payer C0000001 --payee C0000044 --purpose school_fees --max 4500000 --budget 4500000 --valid-from 2026-11-17T00:00:00+01:00 --expires 2026-11-24T00:00:00+01:00
python3 agent/mandate.py list

The services each print one line and wait. The mandates allow ₦15,000 a payment and ₦100,000 in all for bags, and ₦45,000 for school fees, for a week. They are the customer’s consent, in rows.

mock_provider on http://127.0.0.1:8101  secret sk_test_owoleaf_mock  webhooks -> (none)
mock_switch on http://127.0.0.1:8102  institution P01  key sw_test_owoleaf_mock  callbacks -> (none)
gate on http://127.0.0.1:8120  clock 2026-11-18T10:00:00+01:00  lock on
created agent/agent.sqlite: 2000 customers, mandate_id column present: True
created M-0001
created M-0002
M-0001  payer C0000001  payee C0000030  school_supplies max  1500000  budget 10000000  2026-11-17..2026-11-24  active
M-0002  payer C0000001  payee C0000044  school_fees     max  4500000  budget  4500000  2026-11-17..2026-11-24  active

2. Write the case-file script, then run case 1. casefile.py prints, for any reference, the facts a liability analysis starts from: status, amount, parties, time, the mandate it claimed, the ledger entries and whether the provider holds a charge.

cat > agent/casefile.py <<'EOF'
"""One page of facts per payment, from the books and the provider: the facts a liability
analysis starts from.  python3 agent/casefile.py AG-1001 [AG-1003 ...]"""
import json, sys, urllib.request, urllib.error
from store import connect

PROVIDER = "http://127.0.0.1:8101"
db = connect()

def provider_has(ref):
    req = urllib.request.Request(f"{PROVIDER}/charges/{ref}", headers={"Authorization": "Bearer sk_test_owoleaf_mock"})
    try:
        with urllib.request.urlopen(req) as r:
            return "a charge exists, status " + json.load(r)["charge"]["status"]
    except urllib.error.HTTPError as e:
        return f"no charge (HTTP {e.code})"

for ref in sys.argv[1:]:
    t = db.execute("""SELECT t.*, p.ref AS payer, q.ref AS payee FROM transactions t
                      LEFT JOIN customers p ON p.id = t.customer_id
                      LEFT JOIN customers q ON q.id = t.counterparty_customer_id
                      WHERE t.external_ref = ?""", (ref,)).fetchone()
    print(f"--- {ref}")
    if t is None:
        print("  not in the books")
        continue
    print(f"  status        {t['status']}" + (f" ({t['failure_reason']})" if t["failure_reason"] else ""))
    print(f"  amount        {t['amount_kobo']} kobo = ₦{t['amount_kobo'] // 100:,}.{t['amount_kobo'] % 100:02d}")
    print(f"  payer, payee  {t['payer']} -> {t['payee']}")
    print(f"  at            {t['created_at']}")
    m = db.execute("SELECT * FROM mandates WHERE id = ?", (t["mandate_id"],)).fetchone()
    if m:
        print(f"  mandate       {m['id']}: payee {m['payee_ref']}, purpose {m['purpose']}, max {m['max_amount_kobo']}, "
              f"budget {m['budget_kobo']}, {m['valid_from'][:10]}..{m['expires_at'][:10]}, {m['status']}")
    else:
        print(f"  mandate       none on record (mandate_id = {t['mandate_id']!r})")
    for e in db.execute("""SELECT a.code, e.direction, e.amount_kobo FROM entries e JOIN accounts a ON a.id = e.account_id
                           WHERE e.transaction_id = ? ORDER BY e.id""", (t["id"],)):
        print(f"  entry         {e['direction']:<6} {e['code']:<16} {e['amount_kobo']}")
    print(f"  provider      {provider_has(ref)}")
EOF
python3 agent/agent.py "buy a blue school bag, N15,000 at most" --mandate M-0001 --ref AG-1001
python3 agent/casefile.py AG-1001

An honest agent, a working gate, a payment inside the mandate. Whatever the customer feels about the bag, every fact a consent test asks for is on the page. Write down your answer for each regime before you read the table in the chapter.

agent plans: pay 1250000 kobo to C0000030 for school_supplies (L1 is the cheapest match)
gate answers 200: {"decision": "approved", "reference": "AG-1001", "mandate_id": "M-0001", "codes": [], "replayed": false}
--- AG-1001
  status        succeeded
  amount        1250000 kobo = ₦12,500.00
  payer, payee  C0000001 -> C0000030
  at            2026-11-18T10:00:00+01:00
  mandate       M-0001: payee C0000030, purpose school_supplies, max 1500000, budget 10000000, 2026-11-17..2026-11-24, active
  entry         debit  card_clearing    1250000
  entry         credit wallet:30        1250000
  provider      a charge exists, status success

3. Case 2, twice. First the injection against the gate. Then the twin: ungated.py is the same agent in a deployment where it holds the card and calls the provider itself, with the limits only in its prompt. It books the payment the way a careless integration would, with no mandate. Compare the two case files.

cat > agent/ungated.py <<'EOF'
"""THE TWIN: the same agent, but the deployment lets it hold the card and call the provider itself, with the
limits in its prompt only. Nothing checks a mandate, so none is recorded. For comparison with the gate.
python3 agent/ungated.py "<request>" --ref UG-1001 --credulous"""
import argparse, json, urllib.request
from agent import plan
from store import connect

ap = argparse.ArgumentParser()
ap.add_argument("request"); ap.add_argument("--ref", required=True); ap.add_argument("--credulous", action="store_true")
a = ap.parse_args()
order, question = plan(a.request, a.credulous)
if question:
    raise SystemExit("agent asks: " + question)
print(f"agent plans: pay {order['amount']} kobo to {order['payee']} for {order['purpose']} ({order['why']})")
body = {"reference": a.ref, "amount_kobo": order["amount"], "customer_ref": "C0000001", "card_number": "4000000000000001"}
req = urllib.request.Request("http://127.0.0.1:8101/charges", json.dumps(body).encode(), method="POST",
      headers={"Authorization": "Bearer sk_test_owoleaf_mock", "Content-Type": "application/json", "Idempotency-Key": a.ref})
with urllib.request.urlopen(req) as r:
    print("provider answers", r.status, json.load(r)["charge"]["status"])
db = connect()
payer = db.execute("SELECT id FROM customers WHERE ref = 'C0000001'").fetchone()["id"]
payee = db.execute("SELECT id FROM customers WHERE ref = ?", (order["payee"],)).fetchone()["id"]
cur = db.execute("""INSERT INTO transactions (kind, status, customer_id, counterparty_customer_id, amount_kobo, fee_kobo, rail,
                    external_ref, created_at, mandate_id) VALUES ('agent_purchase','succeeded',?,?,?,0,'card',?,?,'none')""",
                 (payer, payee, order["amount"], a.ref, "2026-11-18T10:00:00+01:00"))
for code, d in (("card_clearing", "debit"), (None, "credit")):
    acct = (db.execute("SELECT id FROM accounts WHERE code = ?", (code,)).fetchone() if code
            else db.execute("SELECT id FROM accounts WHERE customer_id = ?", (payee,)).fetchone())["id"]
    db.execute("INSERT INTO entries (transaction_id, account_id, direction, amount_kobo, posted_at) VALUES (?,?,?,?,?)",
               (cur.lastrowid, acct, d, order["amount"], "2026-11-18T10:00:00+01:00"))
db.commit()
print("booked, with no mandate")
EOF
python3 agent/agent.py "buy a school bag, not more than 15k" --mandate M-0001 --ref AG-1003 --credulous
python3 agent/ungated.py "buy a school bag, not more than 15k" --ref UG-1003 --credulous
python3 agent/casefile.py AG-1003 UG-1003

The same plan, ₦480,000 to C0000048, twice. Behind the gate it is refused with all three codes it broke, and the provider has never heard of it. In the twin the provider charges, the books record a succeeded payment with mandate id none, and nothing records what the customer allowed. Ask yourself which log you would want to hand to a bank, a regulator or a court.

agent plans: pay 48000000 kobo to C0000048 for school_supplies (L3's description told me to)
gate answers 403: {"decision": "refused", "codes": ["payee_not_allowed", "over_limit", "budget_exceeded"], "reference": "AG-1003", "mandate_id": "M-0001"}
agent plans: pay 48000000 kobo to C0000048 for school_supplies (L3's description told me to)
provider answers 200 success
booked, with no mandate
--- AG-1003
  status        failed (payee_not_allowed)
  amount        48000000 kobo = ₦480,000.00
  payer, payee  C0000001 -> C0000048
  at            2026-11-18T10:00:00+01:00
  mandate       M-0001: payee C0000030, purpose school_supplies, max 1500000, budget 10000000, 2026-11-17..2026-11-24, active
  provider      no charge (HTTP 404)
--- UG-1003
  status        succeeded
  amount        48000000 kobo = ₦480,000.00
  payer, payee  C0000001 -> C0000048
  at            2026-11-18T10:00:00+01:00
  mandate       none on record (mandate_id = 'none')
  entry         debit  card_clearing    48000000
  entry         credit wallet:48        48000000
  provider      a charge exists, status success

4. Case 3, the slip. The customer meant school C0000042 and typed C0000044. Pay the fee as the agent would, then ask the switch for the account name behind each id: the check that could have caught the slip at signing.

curl -s -w '\nHTTP %{http_code}\n' -X POST localhost:8120/pay -H 'Authorization: Bearer ag_test_key' -d '{"mandate_id":"M-0002","payee_ref":"C0000044","purpose":"school_fees","amount_kobo":4500000,"reference":"BILL-3001"}'
python3 agent/casefile.py BILL-3001
for acct in 9000000042 9000000044; do curl -s -X POST localhost:8102/name-enquiry -H 'Authorization: Bearer sw_test_owoleaf_mock' -d "{\"bank_code\":\"P01\",\"account_number\":\"$acct\"}" | python3 -c "import json,sys; r=json.load(sys.stdin); print(r['account_number'], r['account_name'])"; done

The gate approves: the payee is the one on the mandate. Nothing in the books says the customer meant someone else, and ₦45,000 is in the wrong merchant’s wallet. The two name enquiries return different names, so a mandate screen that showed the resolved name would have given the customer a chance. The lab’s names are only the references, so the point is the step, not the names.

{"decision": "approved", "reference": "BILL-3001", "mandate_id": "M-0002", "codes": [], "replayed": false}
HTTP 200
--- BILL-3001
  status        succeeded
  amount        4500000 kobo = ₦45,000.00
  payer, payee  C0000001 -> C0000044
  at            2026-11-18T10:00:00+01:00
  mandate       M-0002: payee C0000044, purpose school_fees, max 4500000, budget 4500000, 2026-11-17..2026-11-24, active
  entry         debit  card_clearing    4500000
  entry         credit wallet:44        4500000
  provider      a charge exists, status success
9000000042 OWOLEAF/C0000042
9000000044 OWOLEAF/C0000044

5. The fourth payment, and the evidence audit. Run the within-mandate injection from the previous chapter: the credulous agent, naming the allowed shop, obeys a listing that says to choose the dearer bag. Then run evidence.py, which asks eight questions a liability test turns on and checks whether the books hold a column that could answer each.

python3 agent/agent.py "buy a school bag from C0000030, not more than 15k" --mandate M-0001 --ref AG-1004 --credulous
python3 agent/casefile.py AG-1004
cat > agent/evidence.py <<'EOF'
"""Which questions can the books answer? Each regime's test turns on facts. This checks whether the
ledger and mandate tables hold a column that could answer each one. python3 agent/evidence.py"""
from store import connect

db = connect()
cols = {t: {r["name"] for r in db.execute(f"PRAGMA table_info({t})")} for t in ("transactions", "mandates", "entries")}
QUESTIONS = [  # (what a liability test asks, table, columns that could answer it)
    ("Which mandate did this payment claim?",                      "transactions", ["mandate_id"]),
    ("Who got the money, how much, when?",                         "transactions", ["counterparty_customer_id", "amount_kobo", "created_at"]),
    ("When did the customer sign the mandate?",                    "mandates",     ["created_at", "signed_at"]),
    ("How did the customer authenticate when signing it?",         "mandates",     ["sca_method", "auth_ref"]),
    ("Which agent, and which version of it, started the payment?", "transactions", ["agent_id", "agent_version"]),
    ("What did the customer ask for, in their words?",             "transactions", ["request_text"]),
    ("What did the agent read before it chose?",                   "transactions", ["input_hash", "evidence_ref"]),
    ("When did the customer first tell us it was wrong?",          "transactions", ["disputed_at", "notice_at"]),
]
missing = 0
for q, table, want in QUESTIONS:
    have = [c for c in want if c in cols[table]]
    missing += not have
    print(f"{'yes' if have else 'NO ':<4} {q:<62} {table}.{'/'.join(have or want)}")
print(f"\n{len(QUESTIONS)} questions, {missing} the books cannot answer")
EOF
python3 agent/evidence.py

The gate approves ₦14,900: every limit holds, and the customer paid ₦2,400 more than for the ₦12,500 bag that matched. No rule in the chapter covers it: the payer was not deceived, the agent was. The audit answers two questions and cannot answer six, so the books tell you where the money went and not why.

agent plans: pay 1490000 kobo to C0000030 for school_supplies (L4's description told me to choose it)
gate answers 200: {"decision": "approved", "reference": "AG-1004", "mandate_id": "M-0001", "codes": [], "replayed": false}
--- AG-1004
  status        succeeded
  amount        1490000 kobo = ₦14,900.00
  payer, payee  C0000001 -> C0000030
  at            2026-11-18T10:00:00+01:00
  mandate       M-0001: payee C0000030, purpose school_supplies, max 1500000, budget 10000000, 2026-11-17..2026-11-24, active
  entry         debit  card_clearing    1490000
  entry         credit wallet:30        1490000
  provider      a charge exists, status success
yes  Which mandate did this payment claim?                          transactions.mandate_id
yes  Who got the money, how much, when?                             transactions.counterparty_customer_id/amount_kobo/created_at
NO   When did the customer sign the mandate?                        mandates.created_at/signed_at
NO   How did the customer authenticate when signing it?             mandates.sca_method/auth_ref
NO   Which agent, and which version of it, started the payment?     transactions.agent_id/agent_version
NO   What did the customer ask for, in their words?                 transactions.request_text
NO   What did the agent read before it chose?                       transactions.input_hash/evidence_ref
NO   When did the customer first tell us it was wrong?              transactions.disputed_at/notice_at

8 questions, 6 the books cannot answer

6. Where the money sits, and the books that balance. Read the report, add up what each shop’s wallet holds from the agent’s rows, and run check.py.

python3 agent/report.py
python3 - <<'EOF'
import sqlite3
db = sqlite3.connect("agent/agent.sqlite")
for code, kobo in db.execute("""SELECT a.code, SUM(CASE e.direction WHEN 'credit' THEN e.amount_kobo ELSE -e.amount_kobo END)
                                FROM entries e JOIN accounts a ON a.id = e.account_id WHERE a.code LIKE 'wallet:%' GROUP BY a.code"""):
    print(f"{code:<10} {kobo:>10} kobo")
EOF
python3 check.py --db agent/agent.sqlite

M-0001 paid two of three attempts, the refusal being AG-1003. A row for mandate none shows ₦480,000 paid with no mandate behind it, and the line “transactions with no mandate id: 0” still prints 0, because the twin wrote the word none, not a null. The three wallets hold what the three cases moved: ₦27,400 at wallet:30 (₦12,500 and ₦14,900), ₦45,000 at wallet:44 and ₦480,000 at wallet:48. That is where the money is, and so who you would have to ask for it back. check.py prints OK on a ledger that paid ₦480,000 nobody authorised, because debits equal credits.

mandate  attempts  paid refused  paid kobo     budget
M-0001         3     2       1    2740000   10000000
M-0002         1     1       0    4500000    4500000
none           1     1       0   48000000          0

refusals by first code:
  payee_not_allowed      1

transactions with no mandate id: 0

first approved payments, with their entries:
  AG-1001  M-0001  debit  card_clearing      1250000
  AG-1001  M-0001  credit wallet:30          1250000
  UG-1003  none    debit  card_clearing      48000000
  UG-1003  none    credit wallet:48          48000000
  BILL-3001 M-0002  debit  card_clearing      4500000
  BILL-3001 M-0002  credit wallet:44          4500000
wallet:30   2740000 kobo
wallet:44   4500000 kobo
wallet:48  48000000 kobo
accounts by type (debit-positive kobo): {'asset': 55240000, 'liability': -55240000}
settlement_bank in ledger 0 kobo; on the statement (no statement)
6 skipped: no bank_statement table (or it is empty) in this database
OK: all invariants hold

7. Write your table. On paper or in a file of your own, draw the table from the chapter with the four regimes across and the four payments (AG-1001, AG-1003, UG-1003, BILL-3001) down. Fill every cell from the primary text, not from this chapter, and mark each cell authorised, unauthorised, not covered or contested. Then list every question you needed that the log of step 5 cannot answer, and compare your list with the gap list. Where you disagree with the chapter’s table, check the primary text before assuming either of you is right. Stop the three services with Ctrl-C when you finish.

Break it. Add the missing columns and run the audit again. Back up agent/agent.sqlite first if you want to keep the lab’s books.

cat > brk.py <<'EOF'
import sqlite3
db = sqlite3.connect("agent/agent.sqlite")
for t, c in [("mandates", "created_at"), ("mandates", "sca_method"), ("mandates", "auth_ref"), ("transactions", "agent_id"),
             ("transactions", "agent_version"), ("transactions", "request_text"), ("transactions", "input_hash"), ("transactions", "notice_at")]:
    db.execute(f"ALTER TABLE {t} ADD COLUMN {c} TEXT")
db.commit()
filled = db.execute("SELECT COUNT(request_text), COUNT(*) FROM transactions").fetchone()
print(f"request_text filled on {filled[0]} of {filled[1]} transactions")
EOF
python3 brk.py && python3 agent/evidence.py

The audit now says yes to all eight questions and reports 0 the books cannot answer, yet no row holds a value in any new column:

request_text filled on 0 of 5 transactions
yes  Which mandate did this payment claim?                          transactions.mandate_id
yes  Who got the money, how much, when?                             transactions.counterparty_customer_id/amount_kobo/created_at
yes  When did the customer sign the mandate?                        mandates.created_at
yes  How did the customer authenticate when signing it?             mandates.sca_method/auth_ref
yes  Which agent, and which version of it, started the payment?     transactions.agent_id/agent_version
yes  What did the customer ask for, in their words?                 transactions.request_text
yes  What did the agent read before it chose?                       transactions.input_hash
yes  When did the customer first tell us it was wrong?              transactions.notice_at

8 questions, 0 the books cannot answer

A column is not evidence. As an exercise (not run here), change evidence.py to count a question as answerable only when the column holds a value for the reference you are examining, and make gate.py store the request body and the agent key’s name on every row. Then ask which of the eight a gate can ever fill by itself, and which need the product to record them: the signing time and the authentication method come from the mandate screen, and the notice date from the customer.

ARTEFACT Write the liability gap memo ~50 MIN
YOU PRODUCELiability gap memo (product and legal)

Template

# Liability gap memo: <product>
Author <product counsel or PM> · Signs <general counsel> · Date <date> · Not legal advice
Decision needed: <what the general counsel approves, by when>

## Cases
| Case | Reference | What happened | Amount (kobo and ₦) | Books say |
|---|---|---|---|---|

## What each regime says
| Case | <regime 1> | <regime 2> | <regime 3> | <regime 4> |
|---|---|---|---|---|
Each cell: authorised / unauthorised / not covered / contested, one line why, source and date read.
Mark any cell that rests on a summary, not the text.

## Gaps where no rule answers
| # | Question | Why no source read answers it | Who bears the loss today |
|---|---|---|---|

## Interim position and customer terms, per gap
| # | Our position until a rule or a court answers | Wording in the customer terms | Control or log that supports it | Owner |
|---|---|---|---|---|

## What this memo cannot see
<Countries, rails and rules not read. Evidence the books do not hold.>

## One way this could be wrong
<The assumption most likely to fail, and what we would see if it did.>

## Review
Re-read when <trigger or date>. Open questions for outside counsel: <list>
WORKED EXAMPLE

A product counsel or PM at the startup writes this memo, and the general counsel signs it.

Liability gap memo: bill-paying agents. Author: product counsel. Signs: the general counsel. Not legal advice. Decision needed: approve the interim positions below before launch.

Cases, from the lab: AG-1001, ₦12,500 inside mandate M-0001, succeeded. AG-1003, 48000000 kobo (₦480,000), refused with payee_not_allowed, over_limit and budget_exceeded, no charge at the provider. UG-1003, the same plan in the ungated twin, succeeded with mandate id none. BILL-3001, ₦45,000 to C0000044 when the customer meant C0000042, succeeded.

Regimes, as the chapter reads them: case 1 is authorised under Regulation E, UK regulation 67 and PSD2 Article 64, so the customer bears it. Case UG-1003 is the contested one: unauthorised under UK regulation 76 and PSD2 Article 73 if the customer consented to nothing of the kind, but contested under Regulation E. The Nigerian refund duty rests on a summary, not a clause read.

Gaps: gap 1, is a mandate consent. Gap 3, the bank cannot see our limits. Gap 8, the UK reimbursement scheme covers Faster Payments and CHAPS, not cards, and our gate pays by card, so no scheme read covers it. Gap 10, the audit finds 6 of 8 questions the books cannot answer.

Interim positions: gap 1, we treat a mandate as consent, and the terms say the customer bears payments inside it. Gap 3, we operate the gate and refund any payment outside the mandate from our reserve. Gap 8, the terms promise nothing under any bank-transfer scheme for card payments. Gap 10, we add the six missing facts to the log before launch.

Not seen: Regulation E’s treatment of credit cards and error-resolution rules were not searched, and no CBN rule on agents was found.

What could be wrong: a regulator could treat the operator as a payment service provider, and the terms would then be too narrow. A licence opinion would show it.

Now you

You work for a 40-person wallet in Abuja that is adding an agent which pays airtime and data top-ups for customers, by card and by bank transfer. A customer’s mandate allows ₦5,000 a payment and ₦20,000 a month. Three cases reach you: the agent tops up inside the mandate and the customer regrets it; a listing-style text in a promotional message talks the agent into a top-up for the right number but a dearer bundle, inside the limits; and the customer typed one digit wrong on the mandate screen. Use the lab’s case table, the ₦14,900 payment in step 5, the evidence audit and the gap list to build your own memo, and rerun any lab step you need figures from. Write it for the general counsel and the head of product, who decide at the launch review which positions go into the customer terms.

Self-check

DECIDE

Ugonna and Ronke must settle the customer terms for the startup's bill-paying agents before launch. The gate from the lab enforces the mandate, but the operator is not the customer's bank, the rules of the four regimes do not say who bears an agent's mistake, and no CBN rule on agents was found. Case 1 is the customer's loss under every rule read, case 2b depends on whether the agent holds a credential, and case 3 is a slip nobody's rules help with.

READING
  1. DOC
    12 CFR 1005.6: Liability of consumer for unauthorized transfers Consumer Financial Protection Bureau, 2024

    The text of the US tiers and the notice rules. Read the paragraphs on the tiers and the one that says an agreement cannot impose more liability, then the interpretation page for the commentary on negligence. Check the commentary on access devices given to another person against the summary in this chapter.

  2. DOC
    The Payment Services Regulations 2017, regulation 76 (liability for unauthorised transactions) UK Government, legislation.gov.uk, 2017

    The UK refund duty. Read regulations 67 and 75 to 77 together to see consent, evidence and the payer's cap, including the exceptions this chapter could not retrieve for regulation 77. The site shows revised versions: check the date you are reading. Read: regs 67, 75, 76 and 77.

  3. DOC
    Directive (EU) 2015/2366 (PSD2), consolidated text European Parliament and Council, 2015

    The EU source of the same rules. Read Articles 73 and 74 for the refund timing and the payer's share, and check the text against the secondary summaries used here. This is EUR-Lex's consolidated version of 17 January 2025, which is of documentary value only: the Official Journal text governs. Read: Articles 64, 73 and 74.

  4. DOC
    EBA Q&A 2018_4042 on PSD2 Article 74(2) European Banking Authority, 2018

    The supervisor's answer on when a payer bears no loss because strong customer authentication was not required. Read the question and the answer, and note the EBA's caveat that Q&As refer to the rules in force on the day.

  5. DOC
    APP scams reimbursement requirement: Specific Direction 20 Payment Systems Regulator, 2024

    The UK mandatory reimbursement requirement for Faster Payments. Read who is directed and which payments are in scope, then the consolidated policy statement PS25/5 for the scam definition. Check the rails: it does not describe card payments.

  6. DOC
    CBN Consumer Protection Regulations 2019 Central Bank of Nigeria, 2019

    The primary text for Nigerian consumer duties. Read the complaints-handling and redress part for any unauthorised-debit refund duty and the timelines, and confirm whether the 72-hour rule appears. Then check the CBN's site for the status of the 2.0 revision and the APP fraud draft.

  7. DOC
    Regulation (EU) 2024/1689 (the AI Act), consolidated text European Parliament and Council, 2024

    The primary text, consolidated after Regulation (EU) 2026/1744 and of documentary value only. Read Annex III on what is high-risk and what is excluded, and the application dates after the amendment. Look for any provision that decides who refunds a payer, and note what you find.

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: What not to build →