Discover our latest AI-powered innovations around faster payments, smarter workflows, and real-time visibility.Learn more →

Journal

Announcing Ledger Event Handlers

Customers now can interact with Modern Treasury’s financial database using business logic and pre-defined templates.

Image of Lucas Rocha
Lucas RochaPMM

Developers building products that move money need to find scalable and reliable ways to track said money movement. A database tailored for financial data is an under-appreciated staple in many fintechs, marketplaces and financial services companies—and it can inform in-product payments, digital wallets, programmatic payouts, and more.

We offer this database as a service via Ledgers. Leading payments companies use Ledgers to integrate double-entry logic directly in their infrastructure. We provide primitives for a scalable data store that are flexible enough to record the unique payments flows of a variety of businesses (find our detailed principles for scaling our Ledgers DB here). We also give our customers expertise on the most common patterns for extending this flexible and un-opinionated API and data store.

Today we’re excited to announce Ledger Event Handlers, a feature to help customers abstract away their most common ledgering patterns. With Ledger Event Handlers, customers can set templates that translate business events into ledger transactions, therefore simplifying and increasing velocity in ledger integrations.

What are Ledger Event Handlers

Ledgers is designed to give developers maximum flexibility when building payments infrastructure. Today, our API lets you create arbitrary double-entry transactions.

Before Ledger Events
Before Ledger Events

This often means engineers building on Ledgers, as well as other consumers of their microservices, need to understand accounting principles. We wrote accounting for developers for this reason: a way to demystify accounting principles for developers who work with products that move money. In practice, engineers needed to add custom double-entry logic to each API call.

Ledger Event Handlers changes this by letting you interact with the ledger using business events instead of double-entry logic.

With Ledger Events
Diagram showing where the Ledger Event Handler fits in

A business event can be any financial transaction that needs to be added to the ledger: interest accrual in a ledger account, a new invoice to be paid, or a payout that deducts a balance. Ledger Event Handlers work as a template that applies a set of double-entry rules to business events of the same type.

Using Ledger Events

Customers can use Ledger Event Handlers in the following ways:

  1. A marketplace executing regular payments to third parties might use ledger accounts to track balances. Instead of specifying what accounts need to be credited or debited each time, an event handler can be defined to treat all payments similarly every month—the API will then automatically parse the appropriate accounts to debit and credit.
  2. A lending or investing platform might use Ledger Event Handler to determine how interest calculations to ledger account balances should be processed.
  3. A digital wallet platform might create handlers that define patterns for user deposits, withdrawals, in-app transfers and more.
  4. An enterprise business, or any company moving money at scale, might create handlers to expose billing APIs to other internal teams, according to their use case.

Ledger Event Handlers can also be a good way to integrate ledgers with other systems. Our ledger events endpoint is designed to take custom data via open-ended json payloads, giving developers additional flexibility.

With Ledger Events II
Other systems' webhooks and API calls can filter into the Ledger Event Handler

Finally, Ledger Event Handlers can complement the use of our Payments API by letting customers customize the logic for logging ledger transactions whenever payment orders or expected payments are created.

Ledger Balance Alerts

Ledger Event Handlers are particularly useful when coupled with additional features we launched recently.

Ledger Balance Alerts can trigger notifications when ledger accounts fall outside pre-specified ranges. Customers can also now create ledger transactions directly when creating associated expected payments in the UI.

Learn More

We published a guide to using Ledger Event Handlers here. Reach out to us if you’re interested in learning more about Ledgers and tracking money movement at scale.

Try Modern Treasury

See how smooth payment operations can be.

Talk to sales