Implementing Multicurrency Transactions
Learn how to implement a multicurrency transaction workflow with Blnk.
Overview
This tutorial will guide you through implementing multicurrency transactions with the Blnk Ledger.
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.
Set up your implementation
A simple multicurrency transaction flow (e.g. USD to GBP) needs:
- Two balances in different currencies. We’ll use USD and GBP for this guide.
- Two transactions: one to debit the source (send USD), and the other the credit the destination balance (receive GBP).
- Use a linked id to connect both transactions together.
Sending USD
Record a transaction for the USD being sent, and deposit it into a liquidity balance (in USD) managed by your organization.
Sending GBP
Next, record a transaction for the GBP received in the destination balance, transferred from a liquidity balance (in GBP) that your organization also manages.
Handling FX rates
Develop a function to compute the amount the recipient will receive in GBP, using real-time FX rates:
Conclusion
This tutorial provides a clear and detailed understanding of money movement between different currencies, ensuring no risk of missing cents.
Other things you can do is:
-
Atomically process both transactions as a bulk transaction ensuring that they either both succeed or both fail.
-
Use multiple destinations to record and charge spread fees and charges typically associated with FX conversions.
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!
Was this page helpful?