Skip to main content

Close Account

In accounting, a closing entry calculates the net debit or credit balance for an account and then credits or debits this balance respectively, to zero the account's balance and move the balance to another account.

Additionally, it may be desirable to forbid further transfers on this account (i.e. at the end of an accounting period, upon account termination, or even temporarily freezing the account for audit purposes.

Example

Given a set of accounts:

AccountDebits PendingDebits PostedCredits PendingCredits PostedFlags
A010020debits_must_not_exceed_credits
B03005credits_must_not_exceed_debits
C0000

The "closing entries" for accounts A and B are expressed as linked chains, so they either succeed or fail atomically.

  • Account A: the linked transfers are T1 and T2.

  • Account B: the linked transfers are T3 and T4.

  • Account C: is the control account and will not be closed.

TransferDebit AccountCredit AccountAmountAmount (recorded)Flags
T1ACAMOUNT_MAX10balancing_debit,linked
T2AC00closing_debit, pending
T3CBAMOUNT_MAX25balancing_credit,linked
T4CB00closing_credit, pending
  • T1 and T3 are balancing transfers with AMOUNT_MAX as the Transfer.amount so that the application does not need to know (or query) the balance prior to closing the account.

    The stored transfer's amount will be set to the actual amount transferred.

  • T2 and T4 are closing transfers that will cause the respective account to be closed.

    The closing transfer must be also a pending transfer so the action can be reversible.

After committing these transfers, A and B are closed with net balance zero, and will reject any further transfers.

AccountDebits PendingDebits PostedCredits PendingCredits PostedFlags
A020020debits_must_not_exceed_credits, closed
B030030credits_must_not_exceed_debits, closed
C025010

To re-open the closed account, the pending closing transfer can be voided, reverting the closing action (but not reverting the net balance):

TransferDebit AccountCredit AccountAmountPending TransferFlags
T5AC0T2void_pending_transfer
T6CB0T4void_pending_transfer

After committing these transfers, A and B are re-opened and can accept transfers again:

AccountDebits PendingDebits PostedCredits PendingCredits PostedFlags
A020020debits_must_not_exceed_credits
B030030credits_must_not_exceed_debits
C025010