save directive allows you to specify a minimum balance for an account, which will be deduced from the account available balance for the transaction.
@merchants:1234 has an initial balance of [USD/2 500], the transaction will fail as the account post-transaction balance would otherwise be less than [USD/2 100].
Should additional source of funds is provided, the account will act as if its balance is [USD/2 100] less than it actually is:
Insufficient funds error
When the requested amount exceeds the available balance (after applyingsave), the transaction fails with an INSUFFICIENT_FUND error.
Example: Account has [GBP/2 120], save [GBP/2 100], available = [GBP/2 20]
Using save with send [ASSET *]
When usingsend [ASSET *] (send entire balance) with save, the behavior depends on the account balance:
Balance greater than save amount
If the balance exceeds the saved amount, the transaction sendsbalance - saved_amount:
[GBP/2 20] is created (120 - 100 = 20).
Balance less than or equal to save amount
If the balance is less than or equal to the saved amount, a transaction with amount 0 is created:A transaction with 0 amount is still created and recorded in the ledger. This can be useful for audit purposes but may need to be filtered out in reporting.
Multiple source accounts with save
When using multiple sources withsave, funds are taken from the saved account up to its available limit, then completed from other sources:
@account_acontributes[USD/2 50](its available balance: 150 - 100)@account_bcontributes[USD/2 30](remainder needed)