Blnk allows you to process similar transactions from multiple sources to a single destination, providing your application with more customization and efficiency.

Simplified flow of how multiple sources work

This provides enhanced flexibility and control over complex money flows within your application. By consolidating multiple sources into one single transaction, you can monitor and manage transactions more effectively, contextualize your transaction, and facilitate easier tracking and reconciliation.

Let’s get started ✨

What we’ll cover …

  1. Sending from multiple sources
  2. Distribution types
  3. Handling transaction references

Sending from multiple sources

Consider a customer receiving USD 30,000 from 3 people. Person A sends 10%, Person B sends USD 20,000, and Person C sends the rest.

UserBalance IDExpectation
Recipientbln_92e4b9b6-0b85-4ef4-87a2-682c31500d38Will receive a total of USD 30,000
Person Abln_f2073f6b-905a-4e3e-b5a2-8d1b3dc2fb7fWill send 10% of USD 30,000
Person Bbln_64c50fb5-32d5-4f78-9f4a-e8b01aaf025dWill send USD 20,000
Person Cbln_7d98dfe9-5c3e-4c9b-b96a-65f6d9f7b89bWill send the remaining amount left

1. Define your transaction parameters

Define the total amount to be sent, the source balances you are sending from, and the destination balance you are sending to.

ParametersDescription
AmountTotal amount to be received by the recipient (USD 30,000).
SourcesBalance IDs of all the balances the amount is sourced from.
DestinationBalance ID of the recipient.

When sending from multiple sources, you can only send to one destination.

2. Initiate the transaction

Call the record-transaction endpoint, and provide the following required fields.

Request
{
    "amount": 30000,
    "precision": 100,
    "reference": "ref_001adcfgf",
    "currency": "USD",
    "sources": [
        {
            "identifier": "bln_f2073f6b-905a-4e3e-b5a2-8d1b3dc2fb7f",
            "distribution": "10%",
            "narration": "Monthly contribution"
        },
        {
            "identifier": "bln_64c50fb5-32d5-4f78-9f4a-e8b01aaf025d",
            "distribution": "20000",
            "narration": "Monthly contribution"
        },
        {
            "identifier": "bln_7d98dfe9-5c3e-4c9b-b96a-65f6d9f7b89b",
            "distribution": "left",
            "narration": "Monthly contribution"
        }
    ],
    "destination": "bln_92e4b9b6-0b85-4ef4-87a2-682c31500d38"
}
FieldDescriptionRequiredType
amountTotal amount of money to be received.Yesfloat
precisionConverts the transaction amount to the lowest unit possible. See also → Understanding precision.Noint64
referenceUnique transaction reference.Yesstring
currencyShort code for your asset class. See also → Defining asset classes.Yesstring
sourcesContains information about the sources from where the money is being sent from. Each object within this array represents a source and has 2 required fields — identifier and distribution.Yes
identifierSender’s balance IDYesstring
distributionSpecific amount being drawn from the respective source.Yesstring
narrationSpecific description for the respective sourceNostring
destinationRecipient’s balance ID.Yesstring
meta_dataCustom data associated with the transactionNoobject

When sending from multiple sources, do not include the source field in your payload. Use the sources array to group the participating balances in your payload.

Once your request is submitted, Blnk creates separate transaction records for each source with their respective amounts. The transactions are computed, queued, and processed like this:

ReferenceCurrencyAmountSourceDestination
ref_001adcfgf1USD3000bln_f2073f6b-905a-4e3e-b5a2-8d1b3dc2fb7fbln_92e4b9b6-0b85-4ef4-87a2-682c31500d38
ref_001adcfgf2USD20000bln_64c50fb5-32d5-4f78-9f4a-e8b01aaf025dbln_92e4b9b6-0b85-4ef4-87a2-682c31500d38
ref_001adcfgf3USD7000bln_7d98dfe9-5c3e-4c9b-b96a-65f6d9f7b89bbln_92e4b9b6-0b85-4ef4-87a2-682c31500d38

At the end of the transaction, the recipient’s balance will have received a total of 30000.

Distribution types

There are three ways you can specify how the amount should be distributed among the sources as you’ve seen in the example above.

Distribution typeDescriptionExample
Specific amountProvide the specific amount of money to be sent"distribution": "20000" - Means USD 20,000 from the total amount should be sent
PercentageCalculates a percentage of the total amount to be sent"distribution": "10%" - Means 10% of the total amount should be sent
”left”Calculates the remaining amount not assigned to a source"distribution": "left" - Means the remaining amount left after others have been deducted should be sent

You can only use the left distribution type once in your request body.

It is crucial to ensure that the total sum of your sources fields is exactly equal to the value specified in the amount field.

Handling transaction references

Blnk auto-generates a unique transaction reference for each transaction record based on the original reference you provided in your transaction request.

A counter, starting at 1, is appended for each transaction record created ensuring that the individual transaction records have unique references derived from the original transaction reference. This makes sure that each transaction record is unique through its modified reference ensuring traceability and management while preserving the integrity of the original transaction’s reference.

Refer to the sample transaction table in Step 3 above to see how it is applied.

Need help?

We are very happy to help you make the most of Blnk, regardless of whether it is your first time or you are switching from another tool.

To ask questions or discuss issues, please join our Discord community.

Get access to Blnk Cloud.

Manage your Blnk Ledger and explore advanced features (access control & collaboration, anomaly detection, secure storage & file management, etc.) in one dashboard.