
Predicting settlement outcomes before funds clear — using open banking data, behavioural analysis, and structured transaction history.
Payment Company (PayCo)'s challenge was to approve fast, low-cost payments while reducing the chance of a transaction failing later when cleared through the Bulk Electronic Clearing System (BECS). The solution combined real-time account data, transaction history, and risk scoring to predict whether a customer would have sufficient balance when the payment actually settled.
The second model focused on understanding the underlying open banking data — mapping APIs to database tables, identifying anomalies, and defining a usable data foundation for risk models and analytics. Together, the data anatomy model builds the trusted data foundation, and the clearance risk model uses that foundation to predict future balance sufficiency and payment success.
Stop otherwise valid transactions from failing because the customer's balance changes before settlement.
The clearance risk model addresses the settlement delay between approval and actual clearing, which can be anywhere from a few hours to several days depending on the settlement clearing window. A transaction approved now may fail later if the customer's balance is debited before settlement.
Maximum window lengths vary by day type. <6h medium · 6h+ high risk
| Window | Mon–Thurs | Friday–Monday | Weekday Public Holiday | 3 Day Weekend | 4 Day Weekend |
|---|---|---|---|---|---|
| 1 | — | — | 5h30 | — | — |
| 2 | — | — | 4h00 | — | — |
| 3 | — | — | 3h45 | — | — |
| 4 | 15h00 | 63h00 | 39h00 | 87h00 | 111h00 |
Authorised payments that deplete bank balances before settlement processing can cause a default.
Consequences of Declined Payments
Note: The settlement window can be anywhere from 3h45 to 111h00.
The model estimates an expected balance at the time clearing occurs, not just the balance at the moment of payment initiation.
Expected Balance Formula
Expected Balance =
Current Available Balance
− Pending PayCo Payments
+ Expected Receipts
− Expected Future Spending
± Risk Adjustment Buffer
Where expected spend = h × s × v × w (h = hours remaining, s = mean spend/hour, v = seasonal weight, w = short-term trend weight).
Customer initiates a transaction through PayCo.
Retrieve live account balance via open banking API.
Sum all PayCo transactions already in-flight in the same settlement window.
Estimate likely incoming credits such as salary or recurring deposits.
Forecast remaining spending for the settlement window using historical patterns.
Adjust for unusual or suspicious behaviour — time-of-day, velocity, manipulation.
Compare expected balance against transaction amount. Approve, divert, or block.
Processing Flow Detail
| Step | Input | Logic | Output |
|---|---|---|---|
| 1 | Payment request | Customer initiates transaction | New payment event |
| 2 | Account balance | Retrieve live balance via API | Available balance |
| 3 | Pending PayCo payments | Sum in-flight transactions | Pending outflows |
| 4 | Expected receipts | Estimate incoming credits | Expected inflows |
| 5 | Expected spending | Forecast spending for window | Expected future outflows |
| 6 | Risk modifiers | Adjust for anomalies | Risk-adjusted value |
| 7 | Decision engine | Compare expected balance vs amount | Approve / divert / block |
Model Components
| Component | What It Does | Example Fields | Output |
|---|---|---|---|
| Expected Payments | Predicts ordinary future spend | hour, weekday, season, historical spend | Forecast spend |
| Unexpected Payments | Flags unusual activity | time, velocity, location, merchant type | Risk flag |
| Manipulation Model | Scores account trust and intent | account age, history, DD usage, declines | Risk multiplier |
| Decision Engine | Converts model output into action | expected balance, buffer, transaction amount | approve / divert / block |
Decision Outcomes
| Outcome | When It Happens | User Experience |
|---|---|---|
| ✅ Allow via BECS | Expected balance covers payment | Standard approval |
| ⚡ Route to RTP | Payment is risky but still valid | Faster settlement option |
| 🚫 Block | Expected balance is too low | Transaction declined |
The architecture uses operational tables for balances, transactions, windows, payment requests, risk modifiers, and expected balances. Some calculations happen in batch; the final decision happens in real time at transaction request time.
Operational Database Schema
| Table | Purpose |
|---|---|
| transactionhistory | Stores transaction records from API calls for aggregation |
| transactionwindows | Aggregates spending by PayCo window, weekday, month, season |
| paymentrequests | Stores payment requests for pending-payment calculations |
| accountbalances | Stores historical balance snapshots |
| expectedbalances | Stores expected balance results and all input variables |
| risktimemods | Stores time-based risk modifiers |
| accountscores | Stores customer/account trust and manipulation risk scores |
| problematicpayments | Stores transactions needing special handling |
Turning raw open banking APIs into a structured platform for risk models and analytics.
Open banking APIs provide data in varying structures across different banks. The challenge was to map these raw API responses into a consistent, queryable database design that supports clearance-risk modelling, exploratory analytics, and future machine learning.
Different APIs provide different slices of data — accounts, transactions, balances, customers, scheduled payments, direct debits, payees, and products. These are combined into account-level, customer-level, merchant-level, and transaction-level datasets.
Pull account, transaction, balance, customer, and payment data from Open Banking APIs.
Unpack JSON responses and standardise fields into a consistent internal format.
Store cleaned records in structured, canonical tables.
Build windows, balance snapshots, metrics, and history into feature tables.
Detect anomalies and discrepancies across banks and data sources.
Produce decision-ready datasets for risk models and business intelligence.
Processing Flow Detail
| Step | Source | Processing | Output |
|---|---|---|---|
| 1 | Open Banking APIs | Pull account, transaction, balance, customer data | Raw API data |
| 2 | Ingestion layer | Unpack JSON and standardise fields | Cleaned records |
| 3 | Database layer | Store in structured tables | Canonical data model |
| 4 | Aggregation layer | Build windows, balances, metrics, history | Feature tables |
| 5 | Audit layer | Detect anomalies and discrepancies | Data quality log |
| 6 | Analytics layer | Produce metrics and model inputs | Decision-ready dataset |
Core API Groups
| API Group | What It Provides | Notes |
|---|---|---|
| Accounts | Account details, balances, product context | Anchor entity for the model |
| Transactions | Merchant, amount, datetime, status | Primary behavioural source |
| Customers | Identity and demographic-linked data | Linked via arrangement ID |
| Direct Debits | Outbound recurring payment behaviour | Useful for trust and cash-flow inference |
| Scheduled Payments | Planned recurring outflows | Important for expected receipts/spend |
| Payees | Recipient details | Useful for non-scheduled payments |
| Products | Product constraints and eligibility | Useful for limits and account type analysis |
Key Derived Tables
| Table | Purpose |
|---|---|
| accountbalances | Historical balance snapshots |
| transactionhistory | Full transaction record store |
| transactionwindows | Aggregated spend by window and period |
| accounts | Core account master data |
| customers | Customer master data |
| payees | Payee and merchant attributes |
| scheduledpayments | Recurring outgoing commitments |
| directdebits | Direct debit patterns and recurring outflows |

A selection of potential reporting metrics
* Most of the above metrics are at the account level, but metrics can easily be constructed at the customer level if required.
Account creation date, product type, ownership, customer identity, and other relatively fixed attributes. Helps determine account age, product type, and baseline trust.
Transaction frequency, inflow/outflow volumes, balance trends, recurring payment behaviour, and merchant relationships. Most likely to change a customer's risk profile over time.
Banks vary in how they populate fields like execution datetime, merchant name, transaction detail, and payee data. The production model needs a robust anomaly list, fallback logic, and bank-by-bank validation to handle inconsistencies.
How data ingestion, modelling, and decisioning work together end-to-end.
Transforms raw API responses into a consistent, queryable data platform.
Canonical Tables
Feature Tables
Data Quality
Predicts balance sufficiency at settlement time using expected balance calculations.
Risk Layers
Calculations
Scoring
✅ Allow via BECS
Expected balance covers payment
⚡ Route to RTP
Payment is risky but valid
🚫 Block
Expected balance too low
Settlement outcomes are recorded and fed back into the model to continuously improve accuracy.
Monitoring
Optimisation
Open banking data must be ingested in near-real-time. Balance snapshots older than a few hours degrade prediction accuracy, especially for high-risk settlement windows (3h45 – 111h00).
Each bank provides data differently — field naming, optional fields, timestamp formats, and transaction categorisation all vary. The data anatomy layer absorbs this complexity so risk models see a single consistent schema.
The gap between transaction approval and BECS settlement ranges from 3h45 to 111h00. Longer windows carry more risk as customers have more time to make other debits and withdrawals before posting.
Different merchants have different risk profiles. High-value goods with delivery delays carry more exposure than instant digital services. Risk thresholds adapt accordingly.
Case study prepared for PayCo — a risk-aware payment platform built on open banking infrastructure.