Building a Savings Application
Learn how to implement scheduled savings deposit with Blnk.
Overview
In this tutorial, you’ll learn how to implement, monitor, and manage scheduled savings deposits with the Blnk ledger. Here’s what we’ll do:
- Create a customer savings wallet balance.
- Initiate a scheduled deposit transaction. For one-time funding: Wallet Funding Tutorial →.
- Update the savings frequency.
For this tutorial, we’ll use the Blnk TypeScript SDK for the implementation. If you prefer, you can also refer to the API reference for details on the available endpoints.
Designing your map
Before writing code, it’s crucial to design a money movement map that outlines how money moves in your system. This serves as the blueprint for your implementation.
For our scheduled savings deposit workflow, here’s our map:
Read more: Scheduling transactions →
Set up your implementation
Based on our map, we’ll implement the following steps:
- Initiate a scheduled transaction to
Savings Wallet
- Monitor the date of the next scheduled deposit to ensure timely execution.
- Set up a new scheduled transaction after the current one has been successfully processed.
Prerequisites
Before starting, ensure you have:
- A running Blnk server instance (e.g. at
http://localhost:5001
). - An API key for Blnk (replace
YOUR_API_KEY
in the code examples). Required for authenticated requests. - The Blnk CLI installed or a connected Blnk Cloud workspace to view your ledger data.
- A customer savings ledger to organise the customers’ savings balances. Learn how: How to Create a Ledger →
Create customer savings balance
Create a balance with the ledger_id
of your Customer Savings Ledger
to represent your customer savings wallet:
This creates a savings balance with a set of default metadata:
- This customer balance is subscribed to scheduled deposits.
- Schedule frequency is monthly.
- The next scheduled savings date can be monitored on the customer balance
Initiate scheduled transaction
Schedule a transaction on the ledger with the scheduled_for
parameter:
A SCHEDULED
transaction is created waiting to be applied on the specified scheduled date.
Set up new scheduled transaction
To schedule the next savings deposit, verify that scheduled_savings
is still active on the customer’s balance and retrieve its frequency.
Blnk sends a webhook when a scheduled transaction gets applied.
Change savings frequency
To change the savings frequency of a balance, use the Update Metadata endpoint:
Conclusion
In this tutorial, we’ve built a scheduled savings workflow for a wallet app using Blnk. Here’s what we covered:
- Setting up savings ledgers and customer savings accounts
- Adding scheduled deposits
- Automatically rescheduling deposits after they’re completed
- Handling deposit frequencies and customer preferences
- Using webhooks to detect completed transactions and schedule new deposits.
With these features, your app offers customers an easy, automated way to save regularly without extra effort. The webhook-based architecture ensures that your system remains resilient and responsive to transaction events.
Can’t find your use case?
If you’re searching for a specific tutorial that isn’t included here, you’re welcome to contribute to our documentation by sharing your expertise or requesting a new tutorial in our Discord community.
We’re always thrilled to expand our resources with the help of our developer community!