SENIORCHAPTER 27

Authenticating the payer: 3-D Secure, OTP and biometrics

A card number proves nothing about who holds the card. Let the issuer ask for proof only when the payment looks risky, and know what each kind of proof can and cannot defend against

55 MINPAYMENTSUPDATED 2026-11-14
PREDICT

In Owoleaf's lab data, 8,534 successful card top-ups went through 3-D Secure without any prompt (frictionless) and 1,297 were challenged for a code. Owoleaf has fraud reports on some of each. Which group has the higher rate of fraud reports?

Authentication asks whether the person paying owns this card. Authorisation asks whether the issuer will pay this amount. A payment can be authorised and still be fraud, and the chargebacks lesson shows where that ends up: with the merchant, who is debited and has to fight. Authentication is the step in front of authorisation that tries to prevent the dispute.

This chapter does not teach fraud detection, which belongs to the Compliance course. It covers one narrow part: the proof the payer is asked for at checkout, who asks, and how the payment’s record changes when the proof is given.

Why a card number is not proof

On a shop terminal the chip creates a one-time code for each payment, and a PIN proves the person. EMVCo’s cybersecurity guide describes a one-time security code produced for every EMV chip transactionas of 2026-11. On a web page there is no chip. The merchant receives a number, an expiry date and a three-digit code, all of which can be read off a card, copied from a leaked database or typed by anyone holding a stolen wallet. That is card-not-present (CNP) payment, as the card chapter set out. The data identifies the card, not who is typing.

So the issuer, the cardholder’s bank, asks for more. Only it can, because it holds what the merchant does not: the registered phone number, the banking app on a known phone, the customer’s history of devices and places. The standard that lets the merchant carry the issuer’s question to the payer and bring the answer back is 3-D Secure.

The general idea has a name: strong customer authentication (SCA), proof from two independent categories. The European rule that sets it out, Commission Delegated Regulation (EU) 2018/389, says authentication must rest on two or more elements categorised as knowledge (something only the user knows), possession (something only the user has) and inherence (something the user is), and that a breach of one must not compromise the others. The copy cited is the UK’s retained version, which may differ from the EU’s current text on EUR-Lexas of 2026-11. It is a European rule and does not bind Nigerian issuers. It is a useful vocabulary, and the section on the CBN below says what Nigeria asks.

Count what an SMS code gives you. It is not knowledge, such as a PIN. It is possession: proof that the person holds the phone that receives the number, or something that has taken over the number. An app approval confirmed with a fingerprint is possession (the enrolled phone) plus inherence (the finger). When someone says “two-factor”, ask which two, and what an attacker must do to defeat each.

3-D Secure: who asks whom

3-D Secure (3DS) takes its name from three domains: the issuer’s, the acquirer’s and the one in between that the card schemes run. EMVCo, which maintains the specification, published a Protocol and Core Functions specification and a Default-SDK specification; its Q&A says version 2.3.1.1 replaced 2.3.1.0 for testing, and its documentation pages list 2.2.0 and 2.3.1 among the releases. Search did not show which version is currentas of 2026-11. Check EMVCo’s documentation pages. This build could not read the specification, so the flow below is an outline from EMVCo’s pages and vendor guides.

Checkoutmerchant + provider’s3DS serverDirectory serverrun by thecard schemeIssuer’s ACSaccess control server:scores the payment1. payment, device and cardholder data go forwardFrictionlessno prompt to the payerChallengecode, app approval or biometric 2. the ACS decides3. the result and proof return to the checkout4. they travel with the authorisation request to the issuer

Read the picture from left to right. The checkout sends what it knows about the payment, the device and the payer. The issuer’s access control server (ACS) scores that data. If the score is good, the ACS answers at once and the payer sees nothing: a frictionless flow. If not, the ACS asks for proof: a challenge. The issuer decides. The merchant side can signal a preference for a challenge or none, but the issuer’s ACS has the last word.

The result travels with the authorisation request, so the issuer already knows how well the payer was authenticated. It comes with an authentication value and a code for how far authentication went. Store both with the payment: in a dispute they are the evidence.

More data lowers the number of challenges, because the ACS is more sure. One payment provider’s documentation (a vendor, not the specification) says 3DS2 lets a merchant and provider send over 100 data elements, such as shipping address, device ID and payment history, so that the issuer can assess riskas of 2026-11. The practical lesson for Ojaline: send the real shipping and billing details, device information and account age. The quality of what you send is the quality of the issuer’s decision, and richer data can mean fewer challenges.

What changes in a dispute

The reason merchants care about 3DS is not only the prevention. A successful authentication changes who bears the cost if the payment is later called fraud. The common name is liability shift. Vendor documentation found by search (Worldline’s, and Checkout.com’s, whose table treats ECI 05 as shifting liability and ECI 07 as not) says that a successful authentication generally moves liability for fraud-coded chargebacks to the issuer; that the shift covers fraud reason codes only, so merchants stay liable for disputes such as goods not received; and that it depends on the scheme, region and the authentication result. These are vendors’ descriptions. The schemes’ own rules, which this build could not read, decide, so ask your acquireras of 2026-11.

What the payer did Who usually carries a later fraud chargeback
No 3DS attempted The merchant, who is debited and may fight
Authenticated, with or without a challenge The issuer, on a fraud reason (per the vendor guides above)
Challenge failed The merchant, if it goes ahead anyway
Merchant-initiated charge on a saved card Usually the merchant, unless that charge was itself authenticated

The Owoleaf lab simplifies this. Its three_ds column has three values: frictionless, challenge and none. The generator lets Owoleaf win most fraud chargebacks where the payer was challenged and few where they were not, frictionless included. That is its rule, not a scheme’s: under the vendor descriptions above, a fully authenticated frictionless payment may also shift liability. Use the lab to learn how to measure, and ask your acquirer which payments carry protection. The mock provider has the same shape: a fraud dispute submitted with no authentication evidence is usually lost.

If a challenge was completed and the payment was still fraud, someone got through the proof, which the next two sections address. A liability shift relieves the loss but does not remove the victim, a customer of the issuer who first meets the problem at your checkout.

The one-time password and how it is taken

A one-time password (OTP) is a short code the issuer sends, usually by SMS, which the payer types back. It is cheap and works on any phone. It proves possession of whatever receives the SMS, which is not always the customer.

SIM swap. An attacker persuades a mobile operator, or someone inside it, to move the victim’s phone number to a SIM the attacker holds. Texts for that number now go to the attacker. Defence is on the sender’s side: look for a recent SIM change before you send. One operator’s developer documentation for a SIM Swap API built on the CAMARA open standards describes returning the date of a number’s last SIM change, for fraud prevention. Availability differs by operator and country, so ask whether your carriers offer itas of 2026-11. If a swap is recent, do not send the code by SMS. Fall back to the banking app, or decline and ask the payer to contact their bank.

Phishing. The attacker builds a page that looks like the checkout or the bank, tricks the customer into entering the card, and then asks for “the code we have sent you”. At the same moment the attacker enters the card on the real checkout, which triggers the real SMS. The victim types the code into the fake page, and the attacker types it into the real one. A code not tied to what the payer approved cannot defend against this. Two defences: put the merchant and the amount in the message, so that a customer who sees “₦850,000 to a merchant you are not visiting” can refuse; and move to methods bound to the real site or device (next section).

Malware. An app on the phone can read incoming SMS, and nothing in the OTP resists that.

NIST’s Digital Identity Guidelines, SP 800-63B-4, dated July 2025, treat the phone network (PSTN) for out-of-band authentication, which includes SMS, as a “restricted” authenticator. Secondary sources found by search say this is in section 3.1.3.3, that restricted does not mean banned, and that out-of-band authentication is not phishing-resistant. this build could not confirm the exact obligations from NIST’s own text; read it before you rely on themas of 2026-11. NIST writes for US federal digital identity, not for card payments. It is a respected statement of the same worry.

A good OTP is more than a six-digit number. It expires within minutes, is single-use and is tied to one payment. Wrong tries are limited (the lab’s provider fails the charge on the third) and resends are rate-limited. The code never appears in a log, an analytics event or a support screen, and nobody should ask a customer to read it to a support agent.

App approval, biometrics and device binding

The stronger flows move the proof off the phone network and into the phone. At the challenge, the ACS sends a push notification to the issuer’s banking app on one enrolled phone. The app shows the merchant and amount, and the customer approves with a fingerprint, a face scan or a PIN.

The fingerprint is not sent to the bank. The phone checks it locally and, if it matches, unlocks a cryptographic key stored on the device, which signs the approval. The bank holds the matching public key and checks the signature. That is possession (the enrolled phone, with its key) plus inherence (the finger). An attacker who clones a number gets nothing.

Standards for this kind of method exist outside payments. The FIDO Alliance, with the W3C’s Web Authentication (WebAuthn) standard, defines passkeys: credentials bound to the site that created them, so a look-alike site cannot obtain a valid answer. The Alliance’s white paper series is about preventing phishing through passkey deployment; the Alliance is an industry body and its claims are its ownas of 2026-11. No Nigerian rule built on this could be confirmed, and the 3DS challenge normally runs in the issuer’s own app or page. The pattern still applies: a proof bound to a device and a site is harder to relay than a code.

Device binding is the practice of tying an account or app to a known device. Law-firm commentary on a CBN circular of 12 March 2026 on instant payment functionalities, reported to take effect on 1 July 2026, says a mobile banking app is tied to one device at a time, that moving to a new device triggers re-activation and fresh authentication, and that a newly activated app is limited to ₦20,000 in its first 24 hours. The commentary conflicts on whether the limit covers outflows only or inflows too. This build did not read the circular, and it concerns instant payments through mobile apps, not cards, but it shows the CBN’s direction: a new device is treated as riskyas of 2026-11.

Two cautions apply. First, every strong method needs a fallback for the customer who changes phone or loses the app. If the fallback is an SMS code, the attacker claims to have lost the app and you have rebuilt the SIM-swap attack: the fallback must not be weaker than what it replaces. Second, biometric matching has failure rates that differ across people and cameras. Test it across your customers and always offer a non-biometric path.

What the CBN asks of card-not-present payments

Take care here: the sources this build could reach are mostly summaries and mirrors, not the CBN’s own files, and each fact below says so.

A mirror of a CBN circular, reference BPS/DIR/CIR/2010/GEN/01/169 of 30 August 2010 on combating card fraud, says second-level authentication for internet transactions is mandatory for all payment cards, and that issuers must allow operations from their web merchants only after second-level verification. This is a third-party copy, not the CBN’s siteas of 2026-11. The CBN’s own Payments System Supervision page lists, among its card-fraud measures, second-level authentication for card-not-present paymentsas of 2026-11. That page summarises policy; it is not the rule’s text.

A CBN circular of 18 December 2025, FPR/DIR/PUB/CIR/01/012, on the seamless use of foreign cards, is reported to require banks and non-bank acquirers to apply multi-factor authentication to withdrawals and online transactions above $200 a day, $500 a week or $1,000 a month, or the naira equivalent. The text is a mirror’s; this build found no reporting of an effective date or amendmentas of 2026-11. For a merchant such as Ojaline, which takes cards from Nigerians abroad and visitors, the engineering consequence is that thresholds are configuration, not constants. They are stated in dollars and the naira equivalent moves with the rate.

The CBN’s Guidelines on Operations of Electronic Payment Channels in Nigeria (2020) cover web acceptance, and search summaries say they tell issuers to add a second factor for cards used on the web channel and not to enable web transactions without the customer’s request. The searches did not show that the text names 3-D Secure, and a CBN draft of October 2025 says it supersedes only the guidelines’ ATM provisionsas of 2026-11. Read its web payments section yourself, and treat the question whether 3DS is mandatory for a Nigerian merchant as open until you have read the text and asked your acquirer. Do not state to a product manager a rule you have only read on a mirror.

Two points hold whichever source you rely on. The duty to authenticate falls first on the issuer, and a merchant’s job is to carry the issuer’s challenge and not to block it. And in the lab data, 463 of the 10,680 card attempts have three_ds equal to none. Where a regulator expects second-level authentication of card-not-present payments, a none is the first place to look for a gap.

Friction, abandonment and the fair comparison

Every challenge is a place to leave. A customer who must wait for a text, switch apps or find the phone in the next room will sometimes not finish. Not every failure is abandonment: delivery delay, an expired code, a page that breaks inside a phone’s checkout view and a wrong number on file all produce the same blank screen.

Track four numbers, each split by device type, bank and network: how often payments are challenged; how many challenges are completed; how many payers leave at the challenge; and fraud chargebacks per 1,000 payments, by whether the payment was challenged. Add the support queue, because “I never got the code” is a metric too.

The comparison is where teams go wrong, as the Predict showed: in Owoleaf’s data the challenged group has ten times the fraud-report rate, but the issuer sent the risky payments to the challenge, so the raw rates compare risky payments with safe ones. A fair comparison holds the risk constant, or looks at outcomes: how many fraudulent payments went on to a chargeback the merchant won. The lab does the second.

Challenge rate trades against fraud loss. Richer data lowers challenges at no cost to security, and a rule that asks for proof on a narrow band of signals, leaving the rest to the issuer’s judgement, is cheaper than a blanket rule.

Choosing when to ask: a rule, its cold start and its cost

You will write one in the lab. Ojaline’s three signals are cheap and available at authorisation: a new device (this customer has never used it before), an IP address placing the payer abroad, and an amount large against the customer’s own median. Each must use only the customer’s earlier attempts. A median over the whole history, as a casual SQL query would take, quietly uses the future.

Two problems appear at once. The first is the cold start: a first-ever attempt has a new device by definition, and no median. In the lab 1,565 of the 10,680 attempts are a customer’s first, and only 8 of the 92 fraudulent ones are, so counting them as “new device” would challenge 14.7% of good attempts for almost no help. The rule skips them. That is a decision: a stolen card used on a brand-new account is not caught by this rule, and another control must carry it.

The second is that a signal that sounds right can be the costly one. large challenges 8.5% of good attempts to catch 15 of the 92 frauds, while new device catches 70 for 4.1%. Measure each signal’s cost separately before combining them.

The cost model is simple, and every parameter is a guess you must replace: a challenge stops some share of fraud (80% in the lab, illustrative), and some share of challenged good customers give up (10%, illustrative). The first saves the fraudulent amounts. The second costs the revenue those payments would have earned and, if you include it, what the customer is worth beyond this payment. Counting only the fee makes friction look free; the lab’s break shows the ranking flipping as you raise the customer’s value.

A rule that challenges one group far more often than another is a fairness question as well as a cost, so the lab splits challenged good attempts by KYC tier. The machine-learning fraud scoring chapter in this module goes deeper.

Where it goes wrong

Each of these looks like a working checkout.

Treating pending as paid. A challenged charge is pending with Awaiting OTP until the payer finishes. Credit the wallet or release the phone on pending and you ship goods for a payment that may fail. Credit on a verified success, as in integrating a provider.

Retrying a failed authentication as a new charge. A failed challenge is an answer. A loop that creates a fresh charge with a new reference makes a second attempt, and perhaps a second challenge, for a customer who did not ask for one. Use idempotency to keep one operation, and let the payer start a new attempt by choice.

A weaker fallback. The app approval has an “I cannot use the app” link that sends an SMS. The attacker clicks it.

Challenging everything. It looks safe and is the most expensive rule, and it blocks the frictionless flow the issuer would have granted.

Logging the code. An OTP in a log line is a credential in a file many people can read.

Forgetting the evidence. The authentication result, the code for how far it went, the device and the time belong on the payment record. When the chargeback arrives, in the chapter on disputes and chargebacks, you need them within the evidence window.

Treating none as normal. A payment that skipped 3DS is a choice, an exemption or a gap. Count them and give each a reason.

Telling a customer too much. “The code was sent to the number ending 1234” helps a fraudster test numbers. Keep error text plain and the same for a wrong card and a wrong code.

What Ojaline does

Ofure and Larai replace the blanket challenge with three decisions. They send the issuer’s ACS the fullest honest data, to raise the share of payments needing no prompt. They request a challenge on a short list of signals, new device and abroad first, and leave the rest to the issuer. And they store the authentication result, the code, the device and the time with every charge, so that Larai’s team can attach them to a dispute. A dashboard shows the share challenged, the share of challenges completed, and fraud chargebacks per 1,000 payments for challenged and unchallenged, by risk band. Their last decision is a review date: the thresholds, the costs and the abandonment guess are assumptions, reread when the data says otherwise.

LAB Fail an OTP three ways, measure who carried the fraud loss, and price a challenge rule ~45 MIN
YOU NEEDPython 3.9 or later (standard library only)labs/finance with the data generated (python3 generate.py) and python3 cards.py runA second terminal for the mock providerNo Docker, no packages

You work in labs/finance. You create five small files there: step1_otp.py, step2_by_3ds.py, rule.py, step3_rule.py and step4_truth.py. The data is the generated books at seed 42 and scale 0.1, so your numbers match the ones below. All queries run through Python’s sqlite3 module; no sqlite3 program is needed. Do not open data/answers/card_fraud_truth.csv until step 5. It says which card payments really were fraud.

1. Check the books and start the provider.

cd labs/finance
ls data/finance.sqlite >/dev/null 2>&1 || python3 generate.py
python3 check.py
card book: 10,680 card attempts, 109 disputes for 91,728,900 kobo; checks 12-15 run
accounts by type (debit-positive kobo): {'asset': 17355054889, 'equity': -5000000000, 'expense': 110590267, 'income': -221782321, 'liability': -12243862835}
settlement_bank in ledger 17,189,646,589 kobo; on the statement 17,192,741,324 kobo
OK: all invariants hold

If there is no card book: line, run python3 cards.py first (it adds the card tables and changes nothing else). A line about the loan book appears too if you ran loans.py.

In a second terminal, start the provider and leave it running:

cd labs/finance
python3 mock_provider.py --fresh

2. Fail the one-time password three ways. Test card 0006 answers pending with Awaiting OTP and a next_action. The test OTP is 123456. Save as step1_otp.py.

import json, secrets, urllib.error, urllib.request

BASE = "http://127.0.0.1:8101"
HEAD = {"Authorization": "Bearer sk_test_owoleaf_mock", "Content-Type": "application/json"}


def call(method, path, body=None):
    data = json.dumps(body).encode() if body is not None else None
    req = urllib.request.Request(BASE + path, data=data, headers=HEAD, method=method)
    try:
        with urllib.request.urlopen(req) as r:
            return r.status, json.load(r)
    except urllib.error.HTTPError as e:
        return e.code, json.load(e)


def start(label):
    """A card payment of ₦25,000 on test card 0006, which asks for a one-time password."""
    ref = f"OJ-{label}-{secrets.token_hex(3)}"
    status, b = call("POST", "/charges", {"reference": ref, "amount_kobo": 2_500_000, "customer_ref": "C0000042",
                                          "card_number": "411111111111" + "0006", "metadata": {"order": ref}})
    c = b["charge"]
    print(f"   charge: HTTP {status}, status={c['status']}, response={c['gateway_response']!r}, "
          f"paid_at={c['paid_at']}, next_action={c['next_action']['type']}")
    return ref


def otp(ref, code):
    status, b = call("POST", f"/charges/{ref}/otp", {"otp": code})
    if status == 200:
        c = b["charge"]
        print(f"   otp {code}: HTTP 200, status={c['status']}, response={c['gateway_response']!r}, paid_at set: {c['paid_at'] is not None}")
    else:
        extra = f", attempts_left={b['attempts_left']}" if "attempts_left" in b else ""
        print(f"   otp {code}: HTTP {status}, {b['error']}: {b['message']}{extra}")


print("A. the right password at once")
ref = start("A")
otp(ref, "123456")

print("B. two wrong, then the right one on the third try")
ref = start("B")
for code in ("000000", "111111", "123456"):
    otp(ref, code)

print("C. three wrong, then the right one")
ref = start("C")
for code in ("000000", "111111", "222222", "123456"):
    otp(ref, code)
status, b = call("GET", f"/charges/{ref}")
c = b["charge"]
print(f"   verification: status={c['status']}, response={c['gateway_response']!r}")
python3 step1_otp.py
A. the right password at once
   charge: HTTP 200, status=pending, response='Awaiting OTP', paid_at=None, next_action=otp
   otp 123456: HTTP 200, status=success, response='Approved', paid_at set: True
B. two wrong, then the right one on the third try
   charge: HTTP 200, status=pending, response='Awaiting OTP', paid_at=None, next_action=otp
   otp 000000: HTTP 400, invalid_otp: wrong OTP, attempts_left=2
   otp 111111: HTTP 400, invalid_otp: wrong OTP, attempts_left=1
   otp 123456: HTTP 200, status=success, response='Approved', paid_at set: True
C. three wrong, then the right one
   charge: HTTP 200, status=pending, response='Awaiting OTP', paid_at=None, next_action=otp
   otp 000000: HTTP 400, invalid_otp: wrong OTP, attempts_left=2
   otp 111111: HTTP 400, invalid_otp: wrong OTP, attempts_left=1
   otp 222222: HTTP 200, status=failed, response='Authentication failed', paid_at set: False
   otp 123456: HTTP 400, otp_not_expected: charge is failed
   verification: status=failed, response='Authentication failed'

Every charge starts pending with paid_at empty: no money, nothing to credit. In B the third try is right and the charge succeeds, so a payer gets three tries. In C the third wrong code answers HTTP 200, not 400, with the charge now failed. A client that treats every 200 as success is wrong here: read status. The right code that arrives afterwards is refused with otp_not_expected. The mock has no expiry and no resend limit, which a real issuer’s OTP has, and it never sends an SMS, so the lab shows the merchant’s side only.

3. Who carried the loss, by 3-D Secure path. Save as step2_by_3ds.py. It counts succeeded card payments by three_ds, how many have a fraud report, and what happened to the fraud chargebacks, then adds up what Owoleaf lost: the amount of chargebacks it did not win, plus the processor’s fee on every one.

import sqlite3

db = sqlite3.connect("data/finance.sqlite")
FEE = db.execute("SELECT MAX(fee_kobo) FROM disputes").fetchone()[0]


def naira(kobo):
    return f"₦{kobo // 100:,}.{kobo % 100:02d}"


print(f"{'3-D Secure':<13}{'succeeded':>10}{'reported':>9}{'per 1,000':>10}{'fraud CBs':>10}{'won':>5}{'lost':>5}{'accepted':>9}")
rows = db.execute("""
    SELECT a.three_ds,
           COUNT(*),
           SUM(EXISTS (SELECT 1 FROM fraud_reports r WHERE r.transaction_id = a.transaction_id)),
           SUM(EXISTS (SELECT 1 FROM disputes d WHERE d.transaction_id = a.transaction_id AND d.reason = 'fraud')),
           SUM(EXISTS (SELECT 1 FROM disputes d WHERE d.transaction_id = a.transaction_id AND d.reason = 'fraud' AND d.status = 'won')),
           SUM(EXISTS (SELECT 1 FROM disputes d WHERE d.transaction_id = a.transaction_id AND d.reason = 'fraud' AND d.status = 'lost')),
           SUM(EXISTS (SELECT 1 FROM disputes d WHERE d.transaction_id = a.transaction_id AND d.reason = 'fraud' AND d.status = 'accepted'))
    FROM card_attempts a JOIN transactions t ON t.id = a.transaction_id
    WHERE t.status = 'succeeded'
    GROUP BY a.three_ds ORDER BY a.three_ds""").fetchall()
for name, n, rep, cb, won, lost, acc in rows:
    print(f"{name:<13}{n:>10,}{rep:>9}{1000 * rep / n:>10.1f}{cb:>10}{won:>5}{lost:>5}{acc:>9}")

print()
print("Who carried the loss on fraud chargebacks (a win returns the amount; the fee is kept either way):")
print(f"{'3-D Secure':<13}{'disputed':>14}{'returned':>14}{'fees':>12}{'Owoleaf lost':>15}")
tot = 0
for name in ("challenge", "frictionless", "none"):
    amount, back, n = db.execute("""
        SELECT SUM(d.amount_kobo), SUM(CASE d.status WHEN 'won' THEN d.amount_kobo ELSE 0 END), COUNT(*)
        FROM disputes d JOIN card_attempts a ON a.transaction_id = d.transaction_id
        WHERE d.reason = 'fraud' AND a.three_ds = ?""", (name,)).fetchone()
    fees = n * FEE
    lost = amount - back + fees
    tot += lost
    print(f"{name:<13}{naira(amount):>14}{naira(back):>14}{naira(fees):>12}{naira(lost):>15}")
print(f"{'all':<13}{'':>14}{'':>14}{'':>12}{naira(tot):>15}")
python3 step2_by_3ds.py
3-D Secure    succeeded reported per 1,000 fraud CBs  won lost accepted
challenge         1,297       42      32.4        37   34    3        0
frictionless      8,534       27       3.2        24    1    4       19
none                449        2       4.5         2    0    1        1

Who carried the loss on fraud chargebacks (a win returns the amount; the fee is kept either way):
3-D Secure         disputed      returned        fees   Owoleaf lost
challenge       ₦267,674.00   ₦253,640.00  ₦37,000.00     ₦51,034.00
frictionless    ₦242,067.00     ₦2,463.00  ₦24,000.00    ₦263,604.00
none              ₦6,986.00         ₦0.00   ₦2,000.00      ₦8,986.00
all                                                      ₦323,624.00

The first table is the Predict: 42 of 1,297 is 3.24%, 27 of 8,534 is 0.32%, ten times the rate, because the risky payments were the ones challenged. The table’s right side is the fair comparison. Challenged fraud chargebacks: 34 of 37 won (92%). Frictionless: 1 of 24 won, and 19 accepted without a fight. Redo one row by hand: for challenge, 26,767,400 kobo was disputed and 25,364,000 returned, so 1,403,400 kobo was lost; add 37 fees of 100,000 kobo, 3,700,000, and the total is 5,103,400 kobo, ₦51,034.00. Remember the rule from the chapter: this is the lab generator’s choice, not a scheme’s, and the fee is kept even on a win.

4. Write the rule, and test it against what Owoleaf knows. Save the rules as rule.py. Each signal uses only the customer’s earlier attempts. Then step3_rule.py counts, for each rule, how many payments it would challenge and how many of the 71 payments with a fraud report it would have caught.

"""Challenge rules for card fundings, using only what is known at authorisation.

Every feature looks at the customer's EARLIER attempts, never later ones. Money is integer kobo.
"""
import sqlite3
import statistics

DB = "data/finance.sqlite"
LARGE_TIMES = 3        # 'large' means above this multiple of the customer's median earlier attempt
MIN_HISTORY = 3        # earlier attempts needed before a median means anything


def attempts(path=DB):
    """Every card attempt in time order, with the three signals and what Owoleaf later learned."""
    db = sqlite3.connect(path)
    reported = {r[0] for r in db.execute("SELECT DISTINCT transaction_id FROM fraud_reports")}
    rows = db.execute("""SELECT t.id, t.customer_id, t.amount_kobo, t.fee_kobo, t.status, a.device_age_days,
                                a.ip_state, a.three_ds
                         FROM transactions t JOIN card_attempts a ON a.transaction_id = t.id
                         ORDER BY t.created_at, t.id""").fetchall()
    earlier, out = {}, []
    for tid, cid, amount, fee, status, age, ip, three_ds in rows:
        before = earlier.setdefault(cid, [])
        median = statistics.median(before) if len(before) >= MIN_HISTORY else None
        out.append({
            "id": tid, "customer": cid, "amount": amount, "fee": fee, "succeeded": status == "succeeded",
            "three_ds": three_ds, "reported": tid in reported,
            "new_device": age == 0 and len(before) >= 1,      # a first-ever attempt has no history to compare with
            "abroad": ip == "ABROAD",
            "large": median is not None and amount > LARGE_TIMES * median,
        })
        before.append(amount)
    return out


RULES = {
    "as run (3DS challenge)": lambda a: a["three_ds"] == "challenge",
    "new device": lambda a: a["new_device"],
    "abroad": lambda a: a["abroad"],
    "large": lambda a: a["large"],
    "any of the three": lambda a: a["new_device"] or a["abroad"] or a["large"],
    "new device or abroad": lambda a: a["new_device"] or a["abroad"],
    "new device and (abroad or large)": lambda a: a["new_device"] and (a["abroad"] or a["large"]),
}
import rule

data = rule.attempts()
n_reported = sum(a["reported"] for a in data)
print(f"card attempts: {len(data):,}; attempts Owoleaf has had fraud reports on: {n_reported}")
print(f"{'rule':<34}{'challenges':>11}{'share':>7}{'reported hit':>14}{'recall':>8}")
for name, fn in rule.RULES.items():
    hit = [a for a in data if fn(a)]
    caught = sum(a["reported"] for a in hit)
    print(f"{name:<34}{len(hit):>11,}{100 * len(hit) / len(data):>6.1f}%{caught:>14}{100 * caught / n_reported:>7.0f}%")
python3 step3_rule.py
card attempts: 10,680; attempts Owoleaf has had fraud reports on: 71
rule                               challenges  share  reported hit  recall
as run (3DS challenge)                  1,352  12.7%            42     59%
new device                                500   4.7%            53     75%
abroad                                     19   0.2%            17     24%
large                                     919   8.6%            12     17%
any of the three                        1,369  12.8%            56     79%
new device or abroad                      504   4.7%            56     79%
new device and (abroad or large)           67   0.6%            24     34%

This is all an operator can see: 71 payments with a report. “New device or abroad” challenges 504 payments, 4.7%, and hits 56 of the 71 reported, 79%. The three-signal rule hits the same 56 and challenges 1,369. The extra 865 challenges, from large, add no reported fraud. The generated challenge as run caught 42 for 1,352. These recall figures count only fraud that someone reported, which is a part of the fraud.

5. Only now, open the truth file, and price the rules. Save as step4_truth.py. It reads card_fraud_truth.csv and compares each rule with what really was fraud. It also adds the illustrative cost model: a challenge stops 80% of fraud and 10% of the good payers who are challenged give up. EXTRA_VALUE_KOBO is what a lost customer is worth beyond this payment’s fee. It starts at zero.

import csv
import sqlite3
import rule

STOP_PCT = 80          # ILLUSTRATIVE: share of fraudulent attempts a challenge stops
ABANDON_PCT = 10       # ILLUSTRATIVE: share of good payers who give up when challenged
EXTRA_VALUE_KOBO = 0   # ILLUSTRATIVE: what a lost customer is worth beyond this payment's fee


def naira(kobo):
    sign, kobo = ("-" if kobo < 0 else ""), abs(kobo)
    return f"{sign}₦{kobo // 100:,}.{kobo % 100:02d}"


# The hidden truth: opened only now, after the rules were chosen.
truth = {int(r["transaction_id"]): int(r["is_fraud"]) for r in csv.DictReader(open("data/answers/card_fraud_truth.csv"))}
data = rule.attempts()
fraud = [a for a in data if truth[a["id"]]]
good = [a for a in data if not truth[a["id"]]]
print(f"in the truth file: {len(fraud)} fraudulent attempts ({sum(a['succeeded'] for a in fraud)} succeeded), "
      f"{len(good):,} good; Owoleaf had reports on {sum(a['reported'] for a in fraud)} of the {len(fraud)}")
print(f"{'rule':<34}{'caught':>8}{'good hit':>10}{'share':>7}{'customers':>10}{'avoided':>15}{'friction':>15}{'net':>16}")
for name, fn in rule.RULES.items():
    caught = [a for a in fraud if fn(a)]
    hit = [a for a in good if fn(a)]
    avoided = sum(a["amount"] for a in caught if a["succeeded"]) * STOP_PCT // 100
    friction = sum((a["fee"] + EXTRA_VALUE_KOBO) for a in hit if a["succeeded"]) * ABANDON_PCT // 100
    print(f"{name:<34}{len(caught):>4}/{len(fraud)}{len(hit):>10,}{100 * len(hit) / len(good):>6.1f}%"
          f"{len({a['customer'] for a in hit}):>10,}{naira(avoided):>15}{naira(friction):>15}{naira(avoided - friction):>16}")

# Who carries the friction of one rule? Good attempts challenged, by the customer's KYC tier.
db = sqlite3.connect(rule.DB)
tier = dict(db.execute("SELECT id, kyc_tier FROM customers"))
chosen = rule.RULES["new device or abroad"]
print()
print("rule 'new device or abroad': good attempts challenged, by KYC tier")
for t in (1, 2, 3):
    mine = [a for a in good if tier[a["customer"]] == t]
    hit = sum(chosen(a) for a in mine)
    print(f"   tier {t}: {hit:>3} of {len(mine):>5} ({100 * hit / len(mine):.1f}%)")
python3 step4_truth.py
in the truth file: 92 fraudulent attempts (88 succeeded), 10,588 good; Owoleaf had reports on 71 of the 92
rule                                caught  good hit  share customers        avoided       friction             net
as run (3DS challenge)              50/92     1,302  12.3%       664    ₦366,735.20     ₦18,939.89     ₦347,795.31
new device                          70/92       430   4.1%       287    ₦639,280.00      ₦6,596.00     ₦632,684.00
abroad                              19/92         0   0.0%         0    ₦117,296.80          ₦0.00     ₦117,296.80
large                               15/92       904   8.5%       417    ₦356,009.60     ₦40,932.28     ₦315,077.32
any of the three                    74/92     1,295  12.2%       534    ₦663,529.60     ₦46,091.05     ₦617,438.55
new device or abroad                74/92       430   4.1%       287    ₦663,529.60      ₦6,596.00     ₦656,933.60
new device and (abroad or large)    28/92        39   0.4%        34    ₦403,516.00      ₦1,437.24     ₦402,078.76

rule 'new device or abroad': good attempts challenged, by KYC tier
   tier 1: 255 of  6017 (4.2%)
   tier 2: 128 of  3609 (3.5%)
   tier 3:  47 of   962 (4.9%)

The truth: 92 fraudulent attempts, of which Owoleaf had reports on 71 and knew nothing of the other 21. “New device or abroad” catches 74 of the 92, so the reports said 79% and the truth says 80%; the unreported fraud looks much like the reported fraud here. The good customers it challenges: 430 attempts, 4.1% of good ones, by 287 customers. The three-signal rule catches the same 74 and challenges 1,295 good attempts, 534 customers: three times the friction for no gain. abroad hits no good attempt at all, which is a fact about the generator, which places only fraud abroad. Real travellers, VPN users and business trips would show up there; do not read the zero as a property of the world. The avoided and friction columns are the model’s, not facts: 80% and 10% are guesses. The tier table shows how the burden falls: close across tiers here, and the check you would run again on any real rule.

Change EXTRA_VALUE_KOBO in step4_truth.py from 0 to 1_000_000 (₦10,000 of customer value beyond the fee) and run it again. Friction is now ₦1,266,939.89 for the generated challenge and ₦1,303,091.05 for “any of the three”, and both nets turn negative (-₦900,204.69 and -₦639,561.45). “New device or abroad” stays positive at ₦239,933.60, and “new device and (abroad or large)” moves to first place at ₦363,078.76. Try 5_000_000: only abroad and the last rule stay positive, and abroad is first because the generator places only fraud there. The ranking has flipped from “catch the most fraud” to “challenge the fewest good customers”, and every number that moved was an assumption you made up. Which of the rules would you defend to Ofure and Larai, and what measurement would you need from real checkout data to replace the guess?

ARTEFACT Write the step-up authentication policy ~50 MIN
YOU PRODUCEStep-up authentication policy

Template

# Step-up authentication policy: <product or checkout>
Written by <risk PM> with <fraud operations> · Approved by <head of risk> · Version <n>, <date> · Next review <date>

## Purpose and scope
<What this policy decides. Payment types in scope, and what is out of scope.>

## Who is challenged, and on what signals
| Signal | Known at authorisation from | Challenged? | Why this signal | Cost in good customers |
|---|---|---|---|---|
Payments left to the issuer's own judgement: <say so>
Payments with no authentication, and the reason for each: <list>

## Which factor
Default: <factor>. Where the default is unavailable: <fallback, and why it is not weaker>.
Never used: <factor, and why>.

## When the challenge fails or times out
- Wrong codes: <number of tries, what the customer sees>
- No answer within <time>: <what the order does>
- Nothing is credited or shipped on pending. A new attempt starts only when the payer chooses.
- Evidence kept on the payment: <result, code, device, time>

## What we watch
| Metric | Split by | Source | Owner |
|---|---|---|---|
Fraud per 1,000 payments · abandonment at the challenge · chargebacks by authentication result · support contacts about codes

## Assumptions and how this could be wrong
<Each guess (stop rate, abandonment rate, customer value) with its value. One way the policy fails, and what would show it.>

## Review
Cadence: <how often>. Brought forward if: <figure and level>. Owner: <name>. Decision needed now: <approve / amend, by when>.
WORKED EXAMPLE

Ofure writes the policy for Ojaline’s card checkout in the risk PM’s seat, with Larai from disputes standing in for fraud operations; the head of risk approves. The lab’s books are the evidence.

Header: Step-up authentication policy: Ojaline card checkout. Version 1, 20 November 2026. Decision needed: approve this rule by the end of the month.

Challenged on: a new device or a payer abroad. That rule challenges 504 of 10,680 attempts (4.7%) and hits 56 of the 71 reported frauds (79%). Against the truth file it catches 74 of 92 and challenges 430 good attempts (4.1%), 287 customers. Adding large hits the same 74 but challenges 1,295 good attempts, so it is left out. First-ever attempts are skipped, so a stolen card on a new account is not covered here and fraud scoring must carry it.

Factor: the issuer’s app approval where offered, an SMS code otherwise, and no SMS after a recent SIM change. The fallback never sends an SMS to someone who says they lost the app.

Fail or time out: three wrong codes fail the charge, as in lab step 2; a later right code is refused. The customer sees one plain message, the order stays unpaid, and nothing is credited on pending.

Skips: 449 succeeded payments have three_ds of none (lab step 3). Each needs a reason by the next review.

Watch: challenged and unchallenged fraud chargebacks, where the challenged 34 of 37 were won and the frictionless 1 of 24; completion; support contacts about codes; challenged good attempts by KYC tier (4.2%, 3.5%, 4.9%).

Could be wrong: the 80% stop rate and 10% abandonment rate are assumptions. If real abandonment is far higher, or a customer is worth ₦10,000 beyond the fee, the ranking changes; measured abandonment at the challenge would show it.

Review: monthly for three months, then quarterly.

Now you

A month later, Owoleaf’s head of risk asks for a step-up policy for card top-ups before she approves a wider card launch. You are the risk PM, writing with fraud operations. Use the lab on your own copy. The choice is between “new device or abroad” and the narrower “new device and (abroad or large)”: compare challenges, fraud caught and good customers hit in steps 4 and 5, then rerun step 5 with EXTRA_VALUE_KOBO at 1_000_000 and say which rule you would defend. Account for the 449 succeeded payments with three_ds of none (lab step 3), and state how you would measure real abandonment. Name what the policy cannot see: fraud nobody reported, and a stolen card on a first-ever attempt. Your reader is the head of risk, and the decision is which rule to approve and when to review it.

Self-check

DECIDE

Ojaline's phone orders attract stolen cards, and its checkout now challenges every card payment. Completed card checkouts have fallen and support has a queue of codes that never arrived. Ofure can change the policy this week; Larai's team will see the effect in chargebacks only after weeks. What do you change?

READING
  1. DOC
    EMV 3-D Secure (EMVCo) EMVCo

    The body that maintains the specification, on what EMV 3DS is and how its approvals work. Read it for the scope of the standard and the specification versions. It is a summary page; the specifications themselves are on EMVCo's documentation pages.

  2. DOC
    EMV 3DS for E-Commerce: Fighting Fraud and Friction (EMVCo quick resource) EMVCo, 2022

    A short EMVCo resource on how EMV 3DS aims to reduce fraud and friction together, the trade-off this chapter is about. Search snippets describe it as aiming to help issuers identify fraud faster without adding friction; read it before you rely on it.

  3. DOC
    Guidelines on Operations of Electronic Payment Channels in Nigeria (CBN, 2020) Central Bank of Nigeria, 2020

    The CBN's own text on payment channels. Read the web payments provisions for what they say about authenticating card-not-present payments, which this chapter could confirm only through search summaries. Skip the ATM section, which a later CBN draft says is superseded.

  4. DOC
    NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management NIST, 2025

    The most careful public treatment of what each kind of authenticator resists, including out-of-band codes over the phone network. Read the sections on authenticator types and on phishing resistance. It is written for US federal identity services, not card payments.

  5. DOC
    Commission Delegated Regulation (EU) 2018/389: regulatory technical standards on strong customer authentication European Commission, 2018

    The European text that defines knowledge, possession and inherence and requires independence between them. Read the articles on the authentication code and on each element type. It is not Nigerian law; this is the UK's retained copy, and the EU's current text is on EUR-Lex.

  6. DOC
    Passkeys: The Journey to Prevent Phishing (FIDO Alliance) FIDO Alliance, 2025

    The FIDO Alliance on moving from phishable methods to passkeys. Read it for the staged path and what phishing resistance means in practice. It is an industry body's guidance and its adoption figures are the Alliance's own claims.

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: Stablecoins for cross-border payments →