PayCo Data Models

Payment Data Models

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.

Chapter 1

Clearance Risk Minimisation

Stop otherwise valid transactions from failing because the customer's balance changes before settlement.

The Problem

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.

Settlement Clearing Windows

Maximum window lengths vary by day type. <6h medium · 6h+ high risk

WindowMon–ThursFriday–MondayWeekday Public Holiday3 Day Weekend4 Day Weekend
15h30
24h00
33h45
415h0063h0039h0087h00111h00

Transaction Flow vs. Declined Payment Risk

Authorised payments that deplete bank balances before settlement processing can cause a default.

Normal Transaction Flow

Start of Settlement Window
1.Customer purchase amount
2.Platform checks customer available balance
3.Platform approves / allows transaction
4.Platform adjusts internal customer available balance
End of Settlement Window
5.Direct debit posted to customer's bank
6.Customer balance now reflects transaction
7.Platform reverses adjustment to internal balance

Timeline of a Declined Payment

Start of Settlement Window
Customer initiates payment
Platform retrieves available balance via API
Available balance is sufficient — payment approved
Customer makes other debit payments / withdrawals before posting
End of Settlement Window
Transactions posted to BECS
Available balance is no longer sufficient to cover payment
Payment is dishonoured

Consequences of Declined Payments

  • Retailer pays $25 decline fee or customer pays overdraw fee (~$25) and interest on balance
  • Retailer loses the value of any goods/services already exchanged
  • Platform's relationship with the merchant/s negatively impacted

Note: The settlement window can be anywhere from 3h45 to 111h00.

Core Idea: Expected Balance

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).

Processing Flow

1

Payment Request

Customer initiates a transaction through PayCo.

2

Balance Check

Retrieve live account balance via open banking API.

3

Pending Payments

Sum all PayCo transactions already in-flight in the same settlement window.

4

Expected Receipts

Estimate likely incoming credits such as salary or recurring deposits.

5

Expected Spending

Forecast remaining spending for the settlement window using historical patterns.

6

Risk Modifiers

Adjust for unusual or suspicious behaviour — time-of-day, velocity, manipulation.

7

Decision Engine

Compare expected balance against transaction amount. Approve, divert, or block.

Processing Flow Detail

StepInputLogicOutput
1Payment requestCustomer initiates transactionNew payment event
2Account balanceRetrieve live balance via APIAvailable balance
3Pending PayCo paymentsSum in-flight transactionsPending outflows
4Expected receiptsEstimate incoming creditsExpected inflows
5Expected spendingForecast spending for windowExpected future outflows
6Risk modifiersAdjust for anomaliesRisk-adjusted value
7Decision engineCompare expected balance vs amountApprove / divert / block

Three Risk Layers

Model Components

ComponentWhat It DoesExample FieldsOutput
Expected PaymentsPredicts ordinary future spendhour, weekday, season, historical spendForecast spend
Unexpected PaymentsFlags unusual activitytime, velocity, location, merchant typeRisk flag
Manipulation ModelScores account trust and intentaccount age, history, DD usage, declinesRisk multiplier
Decision EngineConverts model output into actionexpected balance, buffer, transaction amountapprove / divert / block

Decision Outcomes

OutcomeWhen It HappensUser Experience
✅ Allow via BECSExpected balance covers paymentStandard approval
⚡ Route to RTPPayment is risky but still validFaster settlement option
🚫 BlockExpected balance is too lowTransaction declined

Architecture

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

TablePurpose
transactionhistoryStores transaction records from API calls for aggregation
transactionwindowsAggregates spending by PayCo window, weekday, month, season
paymentrequestsStores payment requests for pending-payment calculations
accountbalancesStores historical balance snapshots
expectedbalancesStores expected balance results and all input variables
risktimemodsStores time-based risk modifiers
accountscoresStores customer/account trust and manipulation risk scores
problematicpaymentsStores transactions needing special handling
Chapter 2

Data Anatomy & Data Model

Turning raw open banking APIs into a structured platform for risk models and analytics.

The Problem

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.

Core Idea: API-to-Database Mapping

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.

Processing Flow

1

API Ingestion

Pull account, transaction, balance, customer, and payment data from Open Banking APIs.

2

Data Normalisation

Unpack JSON responses and standardise fields into a consistent internal format.

3

Database Storage

Store cleaned records in structured, canonical tables.

4

Aggregation

Build windows, balance snapshots, metrics, and history into feature tables.

5

Data Quality Audit

Detect anomalies and discrepancies across banks and data sources.

6

Analytics Output

Produce decision-ready datasets for risk models and business intelligence.

Processing Flow Detail

StepSourceProcessingOutput
1Open Banking APIsPull account, transaction, balance, customer dataRaw API data
2Ingestion layerUnpack JSON and standardise fieldsCleaned records
3Database layerStore in structured tablesCanonical data model
4Aggregation layerBuild windows, balances, metrics, historyFeature tables
5Audit layerDetect anomalies and discrepanciesData quality log
6Analytics layerProduce metrics and model inputsDecision-ready dataset

Core API Groups

API GroupWhat It ProvidesNotes
AccountsAccount details, balances, product contextAnchor entity for the model
TransactionsMerchant, amount, datetime, statusPrimary behavioural source
CustomersIdentity and demographic-linked dataLinked via arrangement ID
Direct DebitsOutbound recurring payment behaviourUseful for trust and cash-flow inference
Scheduled PaymentsPlanned recurring outflowsImportant for expected receipts/spend
PayeesRecipient detailsUseful for non-scheduled payments
ProductsProduct constraints and eligibilityUseful for limits and account type analysis

Key Derived Tables

TablePurpose
accountbalancesHistorical balance snapshots
transactionhistoryFull transaction record store
transactionwindowsAggregated spend by window and period
accountsCore account master data
customersCustomer master data
payeesPayee and merchant attributes
scheduledpaymentsRecurring outgoing commitments
directdebitsDirect debit patterns and recurring outflows
Data DNA visualization

Dynamic Customer Level Data

A selection of potential reporting metrics

Balances

  • Average account balance
  • Median account balance
  • Max and min account balance
  • % of year with zero or negative balances
  • Average monthly inflow
  • Average monthly outflow

Transactions

  • Number of incoming transactions
  • Number of outgoing transactions
  • Counts of transaction types
  • Average amount for direct debits
  • Number of recurrent direct debits
  • Total amount for recurrent direct debits
  • Number of scheduled payments
  • Total for recurrent scheduled payments

Payees

  • Number of payees
  • Number of recurrent payees
  • List of payees, transaction volume and totals
  • Average number of payees per customer*
  • Average number of payees per account*

Sources

  • Transaction Detail
  • Scheduled Payments
  • Payee Detail
  • Direct Debits

Note

* Most of the above metrics are at the account level, but metrics can easily be constructed at the customer level if required.

Static Data

Account creation date, product type, ownership, customer identity, and other relatively fixed attributes. Helps determine account age, product type, and baseline trust.

Dynamic Data

Transaction frequency, inflow/outflow volumes, balance trends, recurring payment behaviour, and merchant relationships. Most likely to change a customer's risk profile over time.

Anomalies & Caveats

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.

PayCo Platform Architecture

How data ingestion, modelling, and decisioning work together end-to-end.

End-to-End Flow

Layer 1 — Data Sources

ACTIVE
Open Banking APIs
Account Data
Transaction History
Balance Snapshots
Customer Identity
Direct Debits
Scheduled Payments
Payee Records
ingestion & normalisation

Layer 2 — Data Anatomy Model

Transforms raw API responses into a consistent, queryable data platform.

Canonical Tables

  • accounts
  • customers
  • transactionhistory
  • directdebits

Feature Tables

  • accountbalances
  • transactionwindows
  • scheduledpayments
  • payees

Data Quality

  • Anomaly detection
  • Bank-by-bank validation
  • Fallback logic
  • Field consistency audit
structured data feeds

Layer 3 — Clearance Risk Model

Predicts balance sufficiency at settlement time using expected balance calculations.

Risk Layers

  • Expected payments model
  • Unexpected payments model
  • Manipulation detection

Calculations

  • Current balance
  • + Expected inflows
  • − Known outflows
  • − Risk buffer

Scoring

  • Balance sufficiency check
  • Settlement window timing
  • Behavioural trust signals
  • Historical default rate
decision engine

Layer 4 — Payment Decision

✅ Allow via BECS

Expected balance covers payment

⚡ Route to RTP

Payment is risky but valid

🚫 Block

Expected balance too low

feedback loop

Layer 5 — Operational Infrastructure

Settlement outcomes are recorded and fed back into the model to continuously improve accuracy.

Monitoring

  • Settlement success/failure tracking
  • Default rate by settlement window
  • Model accuracy over time

Optimisation

  • Risk buffer calibration
  • Threshold tuning per merchant
  • Seasonal pattern adjustment

Cross-Cutting Concerns

Data Freshness

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).

Bank Variability

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.

Settlement Window Timing

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.

Merchant Context

Different merchants have different risk profiles. High-value goods with delivery delays carry more exposure than instant digital services. Risk thresholds adapt accordingly.

Assumptions, Limitations & Next Steps

Assumptions

  • Open banking data is available in real time
  • Transaction history spans at least 90 days
  • BECS settlement windows are predictable

Limitations

  • Bank data quality varies significantly
  • New accounts have limited history
  • Seasonal models need calibration time

Next Steps

  • ML-based spending prediction
  • Real-time model retraining pipeline
  • Cross-bank anomaly standardisation

Case study prepared for PayCo — a risk-aware payment platform built on open banking infrastructure.