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.
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 theledger_id
of your Customer Savings Ledger
to represent your customer savings wallet:
- 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 thescheduled_for
parameter:
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 thatscheduled_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.