Ledger balances

Balance from source

Compute balance directly from transactions with the Go SDK.

GET/balances/{balance_id}

Use client.LedgerBalance.Get with FromSource set to true to reconstruct a balance from its transactions.

Call the method

balance, _, _ := client.LedgerBalance.Get(
	"bln_5ce86029-3c2e-4e2a-aae2-7fb931ca4c4f",
	&blnkgo.GetBalanceRequest{FromSource: true},
)
FieldTypeDescription
balanceIDstringBalance ID to compute from source.
FromSourceboolMust be true to reconstruct from transactions.

Response

{
  "balance": 9620000,
  "balance_id": "bln_5ce86029-3c2e-4e2a-aae2-7fb931ca4c4f",
  "credit_balance": 9620000,
  "currency": "USD",
  "debit_balance": 0,
  "ledger_id": "ldg_049495c6-356e-4ebc-a45e-60d1e1e16afb",
  "identity_id": "",
  "created_at": "2024-11-26T08:36:36.238244338Z",
  "meta_data": null
}

Go response (*blnkgo.LedgerBalance)

FieldTypeDescription
Balance*big.IntNet amount computed from all transactions.
BalanceIDstringUnique ID for the balance.
CreditBalance*big.IntTotal computed from credit transactions.
DebitBalance*big.IntTotal computed from debit transactions.
CurrencystringCurrency of the balance.
LedgerIDstringLedger this balance belongs to.
IdentityIDstringLinked identity, if any.
CreatedAttime.TimeDate and time the balance was created.
MetaDataMetaDataOptional metadata on the balance.