Skip to content

Latest commit

 

History

History
40 lines (29 loc) · 1.54 KB

balanced-offset.md

File metadata and controls

40 lines (29 loc) · 1.54 KB
layout title hide_hero show_sidebar menubar
page
Balanced offset
true
false
docs-menu

Balanced offsets

ACH files can have "offset records" which are EntryDetail records that balance a file's debits and credits. This means if there are debits, there is a credit offset matching the sum of the debits. If there are credits, there is a debit offset matching the sum of the credits. They are mutually exclusive.

Offset files are used to offset transactions from a single account inside of the ODFI. The Offset is the last record which settles the funds into a single ODFI account.

Setting offset metadata

An ACH Batch supports calling WithOffset to set offset information such as routing number, account number, account type, and a description.

bh := ach.NewBatchHeader()
// fill in the fields

ed := ach.NewEntryDetail()
// fill in the fields

batch := ach.NewBatch(bh)
batch.AddEntry(ed)
batch.WithOffset(&ach.Offset{
    RoutingNumber: "...",
    AccountNumber: "...",
    AccountType: OffsetSavings,
    Description: "...",
})

// On each batch.Create() call the offset record will be re-tabulated

HTTP API

The HTTP server supports balancing existing batches and adding new batches to be balanced.