Architecture
The banking package (~/workspace/source/packages/banking/) provides a unified interface for all providers:
Provider Interface
All banking providers implement the same interface (~/workspace/source/packages/banking/src/interface.ts):
GoCardLess
GoCardLess provides Open Banking access to European banks via PSD2.Configuration
Get API Credentials
Sign up at GoCardLess Bank Account Data and create an application.
Features
- Coverage: European banks supporting PSD2 Open Banking
- Authentication: OAuth via requisitions (consent links)
- Token Management: Automatic access token refresh
- Data: Transactions, balances, account details
API Usage
GoCardLess uses requisition IDs for account access:Implementation Details
Location:~/workspace/source/packages/banking/src/providers/gocardless/
- API Client:
gocardless-api.tshandles authentication and requests - Provider:
gocardless-provider.tsimplements the unified interface - Transforms:
transform.tsnormalizes GoCardLess data to Midday format
Token Refresh Flow
Token Refresh Flow
GoCardLess tokens expire after 1 hour. The API client automatically:
- Caches access tokens with TTL
- Uses refresh token when access token expires
- Generates new token pair when refresh token expires
- Stores tokens in banking cache
~/workspace/source/packages/banking/src/providers/gocardless/gocardless-api.ts:67-81Plaid
Plaid provides banking connectivity for US and Canadian financial institutions.Configuration
Get API Credentials
Sign up at Plaid Dashboard and create an application.
Features
- Coverage: 12,000+ US and Canadian financial institutions
- Authentication: Plaid Link web component
- Sync Mode: Webhook-based with transactions sync API
- Balance Types: Available, current, limit (for credit accounts)
API Usage
Plaid uses access tokens for account access:Implementation Details
Location:~/workspace/source/packages/banking/src/providers/plaid/
- API Client:
plaid-api.tsuses official Plaid Node SDK - Provider:
plaid-provider.tsimplements the unified interface - Transforms:
transform.tsnormalizes Plaid data
Webhook Events
Webhook Events
Plaid sends webhooks for transaction updates:Transaction Webhooks:
SYNC_UPDATES_AVAILABLE- New transactions to syncDEFAULT_UPDATE- Legacy webhook for transaction updatesINITIAL_UPDATE- First sync after connectionHISTORICAL_UPDATE- Historical data syncTRANSACTIONS_REMOVED- Transactions deleted by bank
ERROR- Connection error (marks connection as disconnected)PENDING_DISCONNECT- User initiated disconnectionUSER_PERMISSION_REVOKED- User revoked accessLOGIN_REPAIRED- User reconnected account
~/workspace/source/apps/api/src/rest/routers/webhooks/plaid/index.tsHealth Check
Plaid health status is checked via their public status page:Teller
Teller provides modern banking API access for US banks.Configuration
Get API Credentials
Sign up at Teller.io and get your certificate and private key.
Features
- Coverage: Major US banks
- Authentication: Certificate-based API access
- Balance Strategy: Free balance from transaction
running_balance - Account Details: Instant access to routing/account numbers
API Usage
Teller uses access tokens (enrollment tokens):Implementation Details
Location:~/workspace/source/packages/banking/src/providers/teller/
- API Client:
teller-api.tshandles certificate authentication - Provider:
teller-provider.tsimplements the unified interface - Transforms:
transform.tsnormalizes Teller data
Free Balance Strategy
Free Balance Strategy
Teller charges for balance API calls, but includes
running_balance in transaction data for free.Midday’s balance strategy:- Fetch recent transactions (free)
- Extract
running_balancefrom the first transaction with a balance - Return balance without extra API cost
~/workspace/source/packages/banking/src/providers/teller/teller-api.ts:84-100Webhook Events
Webhook Events
Teller sends webhooks for:
enrollment.disconnected- User disconnected their accounttransactions.processed- New transactions availableaccount.number_verification.processed- Account verification completewebhook.test- Test webhook event
~/workspace/source/apps/api/src/rest/routers/webhooks/teller/index.tsConnection Management
Health Monitoring
Check the health of all banking providers:Connection Status
Check if a connection is still valid:Deleting Connections
Error Handling
All providers use unified error handling viaProviderError:
~/workspace/source/packages/banking/src/utils/error.ts
Rate Limiting
All provider API calls use automatic retry with exponential backoff:- Max retries: 3
- Exponential backoff: 1s, 2s, 4s
- Rate limit detection: HTTP 429 or provider-specific codes