Illustration of a credit-scoring pipeline where personal data passes through a filter gate before reaching a scoring model, with each decision written to a sealed audit ledger

Short answer: Germany's § 37a BDSG, in force from 20 November 2026, permits credit scoring only inside fixed limits: restricted input data, an explanation available for every score, and records kept for about a year. In Spring Boot you meet those limits with a feature allow-list, a per-decision explanation record, an immutable decision log and an "explain my score" API.

Important: I am an engineer, not a lawyer, and none of this is legal advice. The sources I read disagree on a few details, including how payment-account data is treated and whether the cutover is worded as 19 or 20 November. Read the statute itself before you build on any of it. The consolidated BDSG text is on gesetze-im-internet.de, the amending act is in the Bundesgesetzblatt, and Article 22 is on EUR-Lex. Then get your data protection officer to sign off.

I have not built a bureau-grade scoring engine. My background is payments: PSD2 OpenBanking integrations, high-traffic booking flows at AirAsia, and lately PSD3 fraud-liability decision engines and mandate-safe commercial VRP payments. What carries over is the regulated-decision plumbing: allow-lists, snapshots, append-only logs. That is the part this post covers, and it is the part I would expect to survive whatever the final guidance says.

The date is this week. A lot of German fintech and BNPL ("buy now, pay later") backends are about to learn how much of their scoring code nobody can currently explain.

What changes, in one screen

Credit scoring is the practice of turning facts about a person into a number that predicts repayment. GDPR Article 22 limits decisions based solely on automated processing that significantly affect someone, and a declined "pay in 30 days" checkout is the classic case. Until now Germany handled scoring in § 31 BDSG. From 20 November 2026, as I read the coverage, § 37a takes over as a narrow, rule-bound exception: scoring stays allowed, inside these fences.

  1. Restricted inputs. Special-category data (health, religion, ethnicity), names, addresses and social-network data may not feed a score.
  2. Explainability. The lender must be able to describe the criteria behind a specific score in terms the person can follow.
  3. Records. Keep what is needed to reconstruct that explanation, reportedly for one year.

For a backend team, each fence maps to a component, and that is how the rest of this post is organised.

Why this lands on engineers

Scoring services tend to grow by accretion. A data scientist adds a column, a backend developer maps it, and months later nobody can say whether the postcode-derived feature is still in the model. If a customer or supervisor asks why an application was declined, the real answer today is often "let me dig through some old notebooks".

The new rules make that expensive. Forbidden data that slips in through a convenient join is a compliance defect. A decision you cannot tie to a model version is an audit gap. Records that can be edited are not evidence.

So I split the design into four building blocks:

  • A feature allow-list enforced at the pipeline boundary.
  • A per-decision explanation record: inputs, contributions, model version, outcome.
  • An immutable decision log with retention and an audit store.
  • An "explain my score" API that serves those records back to the affected person, in the spirit of GDPR Art. 15 (access) and Art. 22.

Architecture diagram of the compliant scoring service: request enters an allow-list gate, passes to the scoring model, an explanation record is written to an outbox and published through Kafka to an immutable audit store, which also feeds the explain-my-score API

If you have read my piece on the transactional outbox and idempotent consumers, the log mechanics will look familiar. The novelty here is the content of the log and the inputs we refuse to accept.

Block 1: the allow-list belongs at the boundary

The usual first attempt is a deny-list: "never use these ten fields". It fails quietly. Someone adds locality_hint, nobody notices it is an address in disguise, and the deny-list never mentions it.

I flip it: only features that are explicitly registered can reach the model. Anything else is rejected before scoring starts. The compliant path becomes the only path. It is the same policy-as-code approach I used for DORA and NIS2 compliance evidence in Spring Boot: the rule lives in code and config, so it can be tested and diffed.

Each allowed feature carries a stable name, a data category, a note on why it is permitted, and a version.

public enum DataCategory { PAYMENT_BEHAVIOUR, CONTRACT_HISTORY, INCOME_DECLARED, DEVICE_RISK } public record FeatureSpec(String name, DataCategory category, String legalBasisNote, int version) {} @Component public class FeatureAllowList { private final Map<String, FeatureSpec> allowed; public FeatureAllowList(FeatureRegistryProperties props) { this.allowed = props.features().stream() .collect(Collectors.toUnmodifiableMap(FeatureSpec::name, f -> f)); } /** Returns only registered features; throws if anything unknown arrives. */ public Map<String, Object> enforce(Map<String, Object> raw) { var unknown = raw.keySet().stream() .filter(k -> !allowed.containsKey(k)) .toList(); if (!unknown.isEmpty()) { throw new ForbiddenFeatureException(unknown); } return Map.copyOf(raw); } public FeatureSpec spec(String name) { return allowed.get(name); } } 

Two choices are deliberate. Unknown input throws rather than being silently dropped, because a silent drop hides an upstream bug while a loud failure gets fixed within a day. And DataCategory has no value for names, addresses or social data, so nobody can "just add one" without editing an enum, which is visible in code review.

Governance matters more than the code

The class above is twenty lines. The hard part is who may change the registry. My suggested rules:

  • Registry changes go through a pull request that needs sign-off from both the data science owner and whoever speaks for compliance. Make that a CODEOWNERS rule, not a convention.
  • Every entry needs a non-empty legalBasisNote; a startup check refuses to boot otherwise.
  • A CI test loads the registry and fails on any feature name matching a small set of suspicious patterns (addr, street, zip, plz, name, social). It is crude and produces false positives, but it would have caught locality_hint.

Proxies are the harder problem

An allow-list stops named forbidden fields. It does not stop an allowed field from acting as a stand-in for an excluded one. Device model can correlate with income, merchant category with religion or health, tenure with age. I would not claim the statute says anything specific here, but a supervisor reading your documentation will ask. At minimum, run a periodic proxy and disparity analysis over the stored feature snapshots (they are in the log anyway, see Block 2), and record the result next to the registry version. Treat that as an engineering control you can show, not as a legal conclusion.

The unclear part: payment-account data

The sources I found do not agree on how payment-account data, such as transaction history from an open-banking connection, is treated. I cannot settle that for you. What I can do is make the answer a configuration decision with an owner: the registry says whether each category is enabled, and the legal team's reading goes into legalBasisNote. When guidance firms up you flip a flag, redeploy, and have a diff to show. I took the same approach to consent scopes in my OpenBanking PSD2 work.

Block 2: the explanation record

An explanation is only as good as what you stored when the decision was made. You cannot rebuild it later from "current" weights, because the model has very likely been retrained since.

Every scoring call therefore writes a record containing:

  • a decision ID and timestamp,
  • the model version, an immutable identifier (a hash of the artifact works well),
  • the feature snapshot actually used,
  • per-feature contributions (weight times value for a scorecard, attribution values for anything fancier),
  • the score and the outcome,
  • the feature registry version, so you know what the allow-list looked like that day.

For credit I lean towards scorecards or monotonic models, where each contribution can be stated in a sentence. With gradient-boosted trees you can still produce attributions, but the "explanation" is then the output of a second method that itself must be versioned and defended. Simpler models are easier to explain to a customer and to a supervisor. If any part of your pipeline calls an LLM, the same record-everything habit applies; I cover it in observability and guardrails for agentic AI backends.

public record ScoringDecision( UUID decisionId, Instant decidedAt, String subjectRef, // pseudonymous reference, never name or address String modelVersion, int registryVersion, Map<String, Object> inputs, Map<String, Double> contributions, double score, String outcome, boolean humanReviewRequested) {} 

Note subjectRef. The log must not become a second copy of the customer database. Use a pseudonymous reference that your identity service can resolve when an access request arrives. That keeps the log useful for audit and limits the damage if it is ever exposed.

Can you actually replay a decision?

Storing inputs and a model hash only helps if you can load that exact model again. I treat replay as a test, not an aspiration: a nightly job picks a sample of stored decisions, loads the referenced model artifact, re-scores the stored snapshot and asserts the same score. A mismatch pages someone. It also forces you to keep old model artifacts around for at least as long as the log retention, which is a cost people forget to budget.

Block 3: an immutable log with outbox and Kafka

The receipts need three properties: a decision is never logged without its business outcome, a record cannot be edited afterwards, and consumers (audit store, analytics, the explain API) can rebuild their state from the stream.

The outbox pattern covers the first. In the same database transaction that stores the outcome, insert a row into an outbox table. A relay publishes it to Kafka, and consumers deduplicate by decisionId.

@Service public class ScoringService { private final FeatureAllowList allowList; private final ScoringModel model; private final DecisionRepository decisions; private final OutboxRepository outbox; private final ObjectMapper json; @Transactional public ScoringDecision score(String subjectRef, Map<String, Object> rawFeatures) { var inputs = allowList.enforce(rawFeatures); var result = model.evaluate(inputs); var decision = new ScoringDecision( UUID.randomUUID(), Instant.now(), subjectRef, model.version(), allowList.registryVersion(), inputs, result.contributions(), result.score(), result.outcome(), result.needsHumanReview()); decisions.save(DecisionEntity.from(decision)); outbox.save(OutboxEvent.of("scoring.decision.v1", decision.decisionId().toString(), toJson(decision))); return decision; } private String toJson(ScoringDecision d) { try { return json.writeValueAsString(d); } catch (JsonProcessingException e) { throw new IllegalStateException(e); } } } 

Immutability needs enforcement at more than one level. On the Kafka side, use a topic with cleanup.policy=delete and a retention comfortably above your legal minimum, and restrict producers to the relay's service account. In the audit store, make the table append-only: no UPDATE or DELETE grants for the application role, and a hash column that chains each row to the previous one so tampering is detectable.

CREATE TABLE decision_audit ( seq BIGSERIAL PRIMARY KEY, decision_id UUID NOT NULL UNIQUE, subject_ref TEXT NOT NULL, decided_at TIMESTAMPTZ NOT NULL, payload JSONB NOT NULL, prev_hash BYTEA NOT NULL, row_hash BYTEA NOT NULL ); REVOKE UPDATE, DELETE ON decision_audit FROM scoring_app; 

Retention and erasure collide

Here is a tension I would raise with the DPO before launch. You keep records for roughly a year so scores can be explained, yet a customer may also exercise the right to erasure. A hash-chained table makes row deletion awkward by design. My way out is to keep personal content out of the chain: the chained row holds the pseudonymous subjectRef and a hash of the payload, while the readable snapshot lives in a separate table keyed by decision_id. Erasure then deletes or redacts the readable part, and the chain still proves that a decision existed. Whether erasure even applies during the mandatory retention window is a legal call, so make the behaviour configurable rather than hard-coded.

Block 4: the "explain my score" API

The last block returns an explanation to the person affected. Keep the response in plain language and keep it stable, because customer support will paste it into emails.

@RestController @RequestMapping("/v1/score-explanations") public class ExplanationController { private final ExplanationService service; @GetMapping("/{decisionId}") public ExplanationView explain(@PathVariable UUID decisionId, @AuthenticationPrincipal VerifiedSubject caller) { return service.explainFor(caller.subjectRef(), decisionId); } } @Service public class ExplanationService { private final DecisionReader reader; private final FeatureLabels labels; // maps feature name -> customer-facing wording public ExplanationView explainFor(String subjectRef, UUID decisionId) { var d = reader.find(decisionId) .filter(x -> x.subjectRef().equals(subjectRef)) .orElseThrow(() -> new NotFoundException(decisionId)); // same error for "not yours" var top = d.contributions().entrySet().stream() .sorted((a, b) -> Double.compare(Math.abs(b.getValue()), Math.abs(a.getValue()))) .limit(5) .map(e -> new Factor(labels.textFor(e.getKey()), e.getValue() >= 0 ? "helped" : "hurt")) .toList(); return new ExplanationView(d.decidedAt(), d.outcome(), top, d.humanReviewRequested()); } } 

A few things the snippet hides but you must handle:

  • Who is asking. The caller must be strongly authenticated and mapped to the same subjectRef as the decision. Returning "not found" for both missing and foreign decisions avoids leaking which IDs exist.
  • What you may reveal. An explanation of the criteria is not a copy of your model. Expose factors and direction, not raw weights or other people's data. Where a feature comes from a third party, check your contract and the legal position before surfacing it. Trade-secret limits are a legal question, so involve counsel.
  • Human review. Article 22 safeguards revolve around the person being able to contest the outcome and obtain human involvement. The humanReviewRequested flag and a POST .../review-request endpoint that opens a ticket give that right somewhere to land in the system.
  • Corrections. If a customer corrects an input (say, declared income), re-score as a new decision linked to the old one. Never rewrite the original record.

Rollout checklist

This is the order I would work in if I had a week:

  1. Inventory every feature currently reaching the model and classify it; expect to find surprises.
  2. Put the allow-list in front of the model in shadow mode, logging violations without blocking, then switch it to enforcing.
  3. Start writing explanation records and the outbox rows, even before the API exists.
  4. Run the replay job on a sample and fix whatever fails.
  5. Ship the explanation API behind authentication, with support staff trained on the wording.
  6. Agree retention and erasure behaviour in writing with the DPO.

What I would still verify

Three things stay open for me: the exact feature exclusions in the final statute text, the treatment of payment-account data, and the interaction between retention and erasure. All three are configuration in this design rather than code, which is why I chose it. If the official wording turns out stricter or looser than the coverage I read, you edit a registry and a retention setting instead of re-architecting.

If your team scores customers in Germany, read the statute this week, then open your feature pipeline and see which of your inputs you could defend one by one. The ones you cannot are your first tickets.