← Back to blog
PSD319 min read

PSD3 Impersonation Fraud Liability in Spring Boot

PSD3 impersonation fraud liability for engineers: build VoP match handling, pre-payment risk scoring and a tamper-evident evidence ledger in Spring Boot.

A payment passing a payee-name check, a risk score and an evidence ledger in a Spring Boot service

Under PSD3 and the PSR, a bank can be liable to refund a customer who was tricked by someone impersonating the bank, so your Spring Boot payment service needs to prove what it checked, warned and approved for every payment. In practice that means a verification-of-payee check before money moves, a risk score before initiation, and an append-only evidence ledger you can put in front of a dispute handler.

Most PSD3 commentary I have come across is written from the legal side and stops at "who pays". The question that lands on an engineering team afterwards is different: what data must exist, at the moment of the payment, so that the answer to "who pays" can be defended? That is what this post works through, with Spring Boot code. Where I cite the regulation I say so, and where I am guessing I say that too.

The concept in plain words

PSD3 is the planned successor to PSD2 and covers how banks and payment apps handle money movement in the EU. It comes with the PSR (Payment Services Regulation), which is a regulation rather than a directive, so it applies directly in every member state. A PSP is the regulated entity on either side of the payment: a bank, an e-money institution or a payment institution.

Three things in the provisional political agreement matter to engineers. The Council and the Parliament reached that agreement in late November 2025; the legal text was still being finalised and translated afterwards, so check the published consolidated version for article numbers before you quote any of them in a design document.

  1. Impersonation-fraud liability. If a scammer poses as your bank, phones you, and talks you into sending money, the bank can be required to refund you. The logic is that the bank's own identity was abused, and the bank sees patterns across thousands of customers that one customer never will.
  2. Payee verification. Before a transfer goes out, the payer's side checks whether the account number (an IBAN) belongs to the name typed in. Call it VoP. The outcome is match, close match, no match, or check unavailable. For euro instant credit transfers this already exists under the Instant Payments Regulation (EU) 2024/886, and the scheme mechanics sit in the EPC Verification of Payee scheme rulebook. I cover the euro side in SEPA Instant readiness for non-euro PSPs.
  3. Fraud monitoring and data sharing. PSPs have to monitor transactions for fraud, and in defined cases may exchange fraud information with each other, for example identifiers of mule accounts.

Two more terms. SCA is strong customer authentication: two independent factors from knowledge, possession and inherence. Dynamic linking ties the authentication result to the specific amount and payee, so an approval for 50 euros cannot be replayed for 5,000. Later I show how the dynamic-linking hash becomes a ledger entry, because that is where the two ideas connect.

I am an engineer, not a lawyer. Refund windows, thresholds and exemptions may differ once national authorities implement the rules. So I keep every legal parameter in configuration and nothing legal in code. Of all the choices here, that one has the cheapest payoff.

Why evidence is the real product

A payment used to be done when the money left. With liability attached, it is done when you can survive the complaint that arrives three weeks later. The customer says "nobody warned me" or "I never approved that amount". If all you hold is a COMPLETED row in a payments table, you refund every time, because you have nothing to argue with.

In PSD2-era consent work, the audit question was narrow: did the customer consent? A liability regime asks a broader one: what did you know, what did you tell the customer, and what did you do about it? The answer must come from records written at decision time. Reconstructing it later from application logs is a bad bet, since a typical log retention setting of 30 days will have deleted the relevant lines before many claims even arrive. For firms that already produce audit evidence for operational-resilience rules, DORA and NIS2 as code describes a compatible approach.

A worked dispute timeline

Here is the shape of a realistic claim, using made-up values. A customer reports on day 12 that they sent 4,800 EUR to a "safe account" after a call from someone claiming to be the bank's fraud team. The handler opens the ledger and finds this:

SeqTime (UTC)EventWhat it proves
114:02:11VOP_RESULT: NO_MATCH, typed name "Bank Security Dept", vendor code NMTCThe payee name did not match the account holder
214:02:12RISK_ASSESSED: 85, action HOLD, signals NEW_PAYEE_5X_MEDIAN, VOP_NO_MATCH, CUSTOMER_ON_CALLThe system saw three red flags
314:02:12WARNING_SHOWN: template impersonation-v3, app channelThe wording shown, by version
414:03:40CUSTOMER_OVERRIDE: customer pressed continue after the hold screenThe customer chose to proceed
514:03:58SCA_COMPLETED: device key plus biometric, linking hash 9f2c...The approval covered this amount and this IBAN

Here the evidence supports a defence on the process side. But I want to be upfront about a limit. This ledger proves you ran the controls and displayed a warning. It does not prove the controls were effective at preventing the scam, and a regulator or court may care about that distinction. A HOLD that the customer can override with one tap while a fraudster coaches them on the phone is weak prevention, whatever the log says. If your design allows that, treat the ledger as protection for process failures and treat the friction design as the actual defence. Whether "we showed the warning" satisfies the legal test is for your counsel to decide, not something the ledger settles.

Payment request through the VoP client, risk scoring and SCA, with each decision appended to the ledger

The design has four components:

  1. A VoP client that turns the receiving bank's answer into a typed decision.
  2. A risk-scoring pipeline that runs before payment initiation.
  3. An append-only evidence ledger holding warnings, SCA factors and the dynamic-linking hash.
  4. An outbox-backed event for fraud-data sharing.

I wrote an earlier, decision-engine-focused treatment of the same regulation in PSD3/PSR IBAN name verification and fraud-liability engine. This post concentrates on the evidence trail and the plumbing around it.

Step 1: the VoP client and what each answer means

VoP providers return similar shapes: a result code, and on a close match, the name the receiving bank holds. The vendor documentation I have read defines match, close match, no match and an unavailable state, but leaves the question of what your system should do with each one to you. That is a policy decision.

My decision table:

VoP resultCustomer experiencePayment allowed?Evidence recorded
MATCHNo warningYesResult code, timestamp
CLOSE_MATCHShow the real name, ask to confirmYes, after explicit confirmationName shown, confirmation click
NO_MATCHStrong warning, one extra friction stepYes if customer overrides, unless risk score is highWarning text version, override flag
UNAVAILABLENeutral noticeDepends on fail policy belowReason, policy applied

On no-match I warn by default and block when the risk score is also elevated. A mismatch alone has plenty of harmless explanations: a trading name, a married surname, a joint account where only one holder was typed. A mismatch plus a brand-new payee plus an unusually large amount is a different picture. I cannot give you a dependable false-positive rate here, because it depends heavily on your customer mix (consumer versus business accounts behave very differently) and on how the receiving banks normalise names. Run warn-only for a few weeks and measure your own number before you decide where to block.

Latency and the unavailable state

VoP sits in the customer's critical path. Vendors and scheme documents I have seen talk about a few seconds at most, and I set a hard 2-second read timeout in the client below. Past that, the customer is staring at a spinner, and your abandonment rate is part of the cost of the control. Budget it explicitly: if the rest of your pre-payment checks take 300 ms, you are spending most of the experience on one remote call.

"Check unavailable" needs a written policy, because it will happen: the receiving bank is down, its VoP responder times out, or the vendor has an incident. My approach, configurable per payment class:

  • Repeat payee already paid successfully before, small amount: fail open, show a neutral notice.
  • First-time payee above a threshold: fail closed, or route to a delayed-release queue with a message explaining why.
  • Everything between: fail open but raise the risk score by a fixed number of points so the pipeline is more likely to hold it.

Whatever you choose, the ledger must record that the unavailable policy applied and which branch it took. A fail-open decision with no record looks like negligence in a dispute, while the same decision with a recorded, reasoned policy looks like risk management.

Here is the client, using Spring's RestClient (my RestTemplate to RestClient migration notes cover the move if you are still on the old client).

public enum VopOutcome { MATCH, CLOSE_MATCH, NO_MATCH, UNAVAILABLE }

public record VopDecision(VopOutcome outcome, String matchedName, String rawCode, long latencyMs) {}

@Component
public class PayeeVerificationClient {

    private final RestClient http;
    private final MeterRegistry meters;

    public PayeeVerificationClient(RestClient.Builder builder,
                                   @Value("${vop.base-url}") String baseUrl,
                                   MeterRegistry meters) {
        var factory = new JdkClientHttpRequestFactory();
        factory.setReadTimeout(Duration.ofSeconds(2));   // vendors quote 1-2s of added latency
        this.http = builder.baseUrl(baseUrl).requestFactory(factory).build();
        this.meters = meters;
    }

    public VopDecision verify(String iban, String typedName) {
        long start = System.nanoTime();
        try {
            VopResponse r = http.post().uri("/v1/verify")
                .body(Map.of("iban", iban, "name", typedName))
                .retrieve().body(VopResponse.class);
            long ms = (System.nanoTime() - start) / 1_000_000;
            return new VopDecision(map(r.code()), r.matchedName(), r.code(), ms);
        } catch (RestClientException e) {
            meters.counter("vop.unavailable").increment();
            long ms = (System.nanoTime() - start) / 1_000_000;
            return new VopDecision(VopOutcome.UNAVAILABLE, null, e.getClass().getSimpleName(), ms);
        }
    }

    private VopOutcome map(String code) {
        return switch (code) {
            case "MTCH" -> VopOutcome.MATCH;
            case "CMTC" -> VopOutcome.CLOSE_MATCH;
            case "NMTC" -> VopOutcome.NO_MATCH;
            default -> VopOutcome.UNAVAILABLE;   // unknown codes never silently become MATCH
        };
    }
}

Two details matter. The default branch maps unknown codes to UNAVAILABLE, never MATCH, so a code the vendor adds next year degrades safely. And verify never throws, because an exception would skip the evidence write that comes right after it. Since the vendor adds a second or two to every payment, I also trace this hop; distributed tracing in Spring Boot shows how to see which call is slow.

Step 2: risk scoring before the payment starts

Transaction monitoring means watching payments for fraud signals. The design question is where it sits. A monitor running after the payment is sent can only raise an alert. One that runs before initiation can add friction, show a warning, or hold the payment, and that is the position a liability regime rewards.

I model it as an ordered list of small scorers, each returning points and a reason code. Reasons matter as much as the number, because they go into the ledger.

public record RiskSignal(String code, int points) {}

public interface RiskScorer {
    List<RiskSignal> score(PaymentIntent intent, VopDecision vop);
}

@Component
public class NewPayeeLargeAmountScorer implements RiskScorer {
    @Override
    public List<RiskSignal> score(PaymentIntent p, VopDecision vop) {
        var out = new ArrayList<RiskSignal>();
        if (p.payeeAgeDays() < 1 && p.amount().compareTo(p.customerMedianAmount().multiply(BigDecimal.valueOf(5))) > 0) {
            out.add(new RiskSignal("NEW_PAYEE_5X_MEDIAN", 40));
        }
        if (vop.outcome() == VopOutcome.NO_MATCH) out.add(new RiskSignal("VOP_NO_MATCH", 25));
        if (p.sessionHasActiveRemoteAccess()) out.add(new RiskSignal("REMOTE_ACCESS_TOOL", 35));
        if (p.onLiveCallWithBankNumber()) out.add(new RiskSignal("CUSTOMER_ON_CALL", 20));
        return out;
    }
}

@Service
public class RiskPipeline {
    private final List<RiskScorer> scorers;
    public RiskPipeline(List<RiskScorer> scorers) { this.scorers = scorers; }

    public RiskAssessment assess(PaymentIntent p, VopDecision vop) {
        var signals = scorers.stream().flatMap(s -> s.score(p, vop).stream()).toList();
        int total = signals.stream().mapToInt(RiskSignal::points).sum();
        RiskAction action = total >= 70 ? RiskAction.HOLD
                          : total >= 35 ? RiskAction.WARN_STRONG
                          : RiskAction.ALLOW;
        return new RiskAssessment(total, action, signals);
    }
}

The "customer is on a live call" signal is the one I rate highest against bank-impersonation scams, because the defining feature of the scam is a fake agent coaching the victim through the payment. If your mobile app can detect an active call or screen sharing, that is worth more than another amount threshold. The point values and cut-offs above are placeholders to show the structure. Tune them against your own labelled fraud history, and expect to revisit them every few months as scam scripts change.

Step 3: the append-only liability-evidence ledger

I would build this part first, because it is useful even if the final rules shift. It answers: what happened in this payment, in what order, and can you show nobody edited it afterwards?

The rules I follow:

  • Append-only. No updates, no deletes. A correction is a new entry that points at the one it corrects.
  • Hash chained. Each entry stores the hash of the previous entry for the same payment, so tampering breaks the chain.
  • Versioned content. Store the version id of the warning text shown, not just "warning shown". When the wording changes next quarter, you can still prove what this customer saw.
  • Database-enforced. Revoke UPDATE and DELETE on the table for the application role, so even a bug cannot rewrite history.

Choosing the tamper-evidence mechanism

A hash chain in an ordinary table is the lightest option, and it is the one I show. It is worth knowing what it does and does not give you:

OptionStrengthWeakness
Hash chain in PostgreSQL plus revoked UPDATE/DELETECheap, queryable, joins to business dataA database superuser can still rewrite rows and recompute the whole chain
Same, plus periodic anchoring of the latest hash to an external system (a separate account, a timestamping service, object storage)Rewrites older than the last anchor become detectableExtra moving part, anchor frequency is a trade-off
WORM object storage (S3 Object Lock or similar) for exported batchesRetention enforced by the storage layerNot queryable in real time, export lag
Dedicated immutable or ledger databaseBuilt-in verificationNew infrastructure and skills for the team

My usual setup is the first row plus a nightly job that writes the day's last hash to write-once storage under a different credential. That is enough to turn "someone with database access edited history" from silent into detectable. Be aware that a chain per payment protects each payment's story but does not stop someone deleting an entire payment's rows, which the anchor job and a row-count reconciliation against the payments table are meant to catch.

Retention and GDPR

This is the conflict that surprised me most. The ledger holds names, matched names and IBAN-related data, while GDPR gives people erasure rights and expects storage limitation. An immutable table does not sit comfortably with either. Options I considered:

  • Keep personal data out of the chained payload. Store references and hashes (the IBAN hash, a template id, a customer pseudonym), and keep the actual names in a normal table that can be erased or redacted. The chain then remains valid after the personal data is gone.
  • Salt the hashes per customer. A plain hash of an IBAN is easy to reverse by brute force, so keyed hashing or per-record salts are safer.
  • Set a retention period tied to your dispute window and to financial record-keeping obligations, then expire whole partitions of the ledger rather than editing rows. Erasure requests that conflict with a legal retention duty are a conversation for your data-protection officer.

I do not claim to have settled where legal obligation to keep records overrides erasure. What I do know is that "we store everything in an immutable table forever" will not survive a data-protection review, so design the payload to be low-sensitivity from the start.

Schema (PostgreSQL):

CREATE TABLE liability_evidence (
    id            BIGSERIAL PRIMARY KEY,
    payment_id    UUID        NOT NULL,
    seq           INT         NOT NULL,
    event_type    VARCHAR(40) NOT NULL,   -- VOP_RESULT, WARNING_SHOWN, CUSTOMER_OVERRIDE, SCA_COMPLETED, RISK_ASSESSED
    payload       JSONB       NOT NULL,
    prev_hash     CHAR(64),
    entry_hash    CHAR(64)    NOT NULL,
    recorded_at   TIMESTAMPTZ NOT NULL DEFAULT now(),
    UNIQUE (payment_id, seq)
);
REVOKE UPDATE, DELETE ON liability_evidence FROM payments_app;

The writer computes the hash over the previous hash plus the canonical payload:

@Service
public class EvidenceLedger {

    private final JdbcTemplate jdbc;
    private final ObjectMapper json;

    public EvidenceLedger(JdbcTemplate jdbc, ObjectMapper json) {
        this.jdbc = jdbc;
        this.json = json.copy().configure(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS, true);
    }

    @Transactional(propagation = Propagation.MANDATORY)
    public void append(UUID paymentId, String type, Map<String, Object> payload) {
        var last = jdbc.query(
            "SELECT seq, entry_hash FROM liability_evidence WHERE payment_id = ? ORDER BY seq DESC LIMIT 1 FOR UPDATE",
            rs -> rs.next() ? new int[]{rs.getInt(1)} : null, paymentId);
        int seq = last == null ? 1 : last[0] + 1;
        String prev = last == null ? null : jdbc.queryForObject(
            "SELECT entry_hash FROM liability_evidence WHERE payment_id = ? AND seq = ?",
            String.class, paymentId, seq - 1);
        String body = writeJson(payload);
        String hash = sha256((prev == null ? "" : prev) + "|" + type + "|" + body);
        jdbc.update("""
            INSERT INTO liability_evidence (payment_id, seq, event_type, payload, prev_hash, entry_hash)
            VALUES (?, ?, ?, ?::jsonb, ?, ?)""", paymentId, seq, type, body, prev, hash);
    }

    private String writeJson(Object o) {
        try { return json.writeValueAsString(o); }
        catch (JsonProcessingException e) { throw new IllegalStateException(e); }
    }

    static String sha256(String s) {
        try {
            var d = MessageDigest.getInstance("SHA-256").digest(s.getBytes(StandardCharsets.UTF_8));
            return HexFormat.of().formatHex(d);
        } catch (NoSuchAlgorithmException e) { throw new IllegalStateException(e); }
    }
}

Propagation.MANDATORY is deliberate. The ledger write must join the same transaction as the business step, so a payment can never move forward without its evidence, and evidence can never exist for a step that rolled back.

One verification note: a chain only helps if somebody checks it. I run a scheduled job that walks recent payments, recomputes each hash from the stored payload, and pages someone on the first mismatch. Without that job, the chain is decoration.

What goes in the payloads

For each payment I record, in order:

  • VOP_RESULT: outcome, vendor code, latency, and a reference to the matched name rather than the name itself (see the GDPR notes above).
  • RISK_ASSESSED: total score, action, every signal code.
  • WARNING_SHOWN: warning template id and version, the channel (app, web), and the time it was displayed.
  • CUSTOMER_OVERRIDE: the customer chose to continue after a no-match or strong warning.
  • SCA_COMPLETED: which factors were used (for example a device-bound key plus biometric), and the dynamic-linking hash, a digest of amount, currency, payee IBAN and a nonce, signed during authentication.

That last entry is what connects SCA to the ledger in a way you can actually implement. In a dispute over "I never approved that amount", you recompute the hash from the stored payment instruction and compare it to the one the device signed. If they differ, you have found a defect in your own flow, and conceding quickly is the right call. If you are exploring wallet-based identity proofs for the SCA step, my EUDI wallet verifier guide covers that.

public String dynamicLinkingHash(BigDecimal amount, String currency, String payeeIban, String nonce) {
    String canonical = amount.setScale(2, RoundingMode.HALF_EVEN).toPlainString()
        + "|" + currency + "|" + payeeIban.replace(" ", "").toUpperCase() + "|" + nonce;
    return EvidenceLedger.sha256(canonical);
}

Defending or conceding inside the window

A refund claim arrives with a clock attached. I built a small ClaimAssessor that reads the ledger and produces a one-page verdict: was VoP run, was a warning shown, was it a no-match that the customer overrode, did SCA complete with a matching hash, was the risk action respected? If every control fired and the customer overrode a clear warning, the case supports a defence on process. If a control was skipped, say VoP was unavailable and the policy failed open on a first-time payee, the assessor recommends conceding. Conceding quickly costs less than losing slowly, and the ledger turns that into a ten-minute decision rather than a week of digging through logs. The final call on any contested claim stays with a human.

Step 4: fraud-data sharing through an outbox

The new rules allow PSPs to exchange fraud information, for instance an IBAN confirmed as a mule account. The engineering problem is reliability. If you update your internal blocklist and then fail to publish the share event, partners never learn about it. If you publish and the database commit fails, you told partners something that never happened internally.

This is the textbook case for the transactional outbox, which I describe in transactional outbox and idempotent consumers for payment systems. The business change and the event row commit together, and a relay publishes afterwards.

@Service
public class MuleReportService {

    private final JdbcTemplate jdbc;
    private final EvidenceLedger ledger;

    @Transactional
    public void confirmMule(UUID caseId, UUID paymentId, String iban, String reasonCode) {
        jdbc.update("INSERT INTO internal_blocklist (iban, reason, case_id) VALUES (?, ?, ?) ON CONFLICT DO NOTHING",
                    iban, reasonCode, caseId);
        ledger.append(paymentId, "MULE_CONFIRMED", Map.of("iban_hash", EvidenceLedger.sha256(iban), "reason", reasonCode));
        jdbc.update("""
            INSERT INTO outbox (aggregate_id, topic, payload, created_at)
            VALUES (?, 'fraud.mule.confirmed', ?::jsonb, now())""",
            caseId, "{\"ibanHash\":\"" + EvidenceLedger.sha256(iban) + "\",\"reason\":\"" + reasonCode + "\"}");
    }
}

Notice the event carries a hash of the IBAN, not the raw value. What may be shared, with whom and in what form is a data-protection question. Hashed identifiers that partners match against their own data are a conservative starting point, but get your compliance team to confirm the permitted scope before wiring this to an external network. The consumer side must be idempotent, since partners may receive the same event twice. (As noted above, a plain unsalted hash of an IBAN can be brute-forced, so a shared keyed scheme agreed with partners is better than the bare SHA-256 shown here for brevity.)

Test strategy that catches real problems

Some vendors publish simulator account numbers that return each outcome on demand, and I build tests on that idea with three layers:

  1. Unit tests for the decision table. Parameterised: every VoP outcome crossed with every risk action, asserting allowed or blocked. This table is your policy, and the test is its executable copy.
  2. Contract tests with WireMock. Stub the vendor with each code, including timeouts, 500s and an unknown code, and assert the client returns UNAVAILABLE rather than throwing or returning MATCH.
  3. Ledger integrity tests. Run a full payment against a Testcontainers PostgreSQL, then verify the chain by recomputing every hash. Add a negative test that attempts an UPDATE as the app role and expects a permission error.
@Test
void unknownVendorCodeNeverBecomesMatch() {
    wireMock.stubFor(post("/v1/verify").willReturn(okJson("{\"code\":\"ZZZZ\"}")));
    var d = client.verify("DE89370400440532013000", "Anna Schmidt");
    assertThat(d.outcome()).isEqualTo(VopOutcome.UNAVAILABLE);
}

Then one end-to-end scenario in staging every release: a first-time payee, a no-match, a customer on a simulated call, an override, and a refund claim. The assessor should return "defend" only when every ledger entry exists. Delete one entry in the test and the verdict must flip to "concede".

What I would do this quarter

If you are a smaller team, do not wait for the final national text. In order:

  1. Add the evidence ledger to your existing payment flow. It is useful for PSD2 disputes today.
  2. Put the VoP client behind a feature flag in warn-only mode and measure your real outcome rates and latency for a month.
  3. Add the pre-initiation risk pipeline with two or three high-signal scorers.
  4. Wire the outbox event, and keep the external publisher disabled until compliance approves the sharing scope.

Recurring-payment rails need the same discipline; my notes on commercial VRP mandates in Spring Boot show how consent evidence works there, and the ledger design carries over almost unchanged. If you are facing a PSD3 build and want a second pair of eyes, reach out through the contact section.

Related Articles

Start today by creating the liability_evidence table in a staging database, revoking UPDATE and DELETE from your application role, and appending one VOP_RESULT entry from your existing payment flow.

FAQ

What is impersonation-fraud liability under PSD3 and the PSR?

A bank or payment provider may have to refund a customer who was tricked by a fraudster pretending to be the bank itself. The customer is repaid first, and the provider then has to show what it did to prevent the scam if it wants to dispute the claim.

What does a close match mean in a payee check?

The name is similar but not identical, such as a missing middle name or a typo. The payer is shown the name the receiving bank holds and asked to confirm it is the person they meant to pay.

Why do payment providers need an evidence ledger for fraud claims?

When a customer says they were scammed, the provider must prove which warnings it showed and how the payment was approved. An append-only, hash-chained ledger with its latest hash anchored elsewhere is a credible way to give that proof, because edits to older entries become detectable.

What should a PSP build now to prepare for PSD3?

Start with a tamper-evident evidence log, add a payee name check in warn-only mode, and score each payment for risk before initiation. Keep legal parameters in configuration, and design ledger payloads so they do not hold more personal data than they need to.