Home

Awesome

Moov Banner Logo

<p align="center"> <a href="https://moov-io.github.io/ach/">Project Documentation</a> · <a href="https://moov-io.github.io/ach/api/#get-/files">API Endpoints</a> · <a href="https://moov.io/blog/education/ach-api-guide/">API Guide</a> · <a href="https://slack.moov.io/">Community</a> · <a href="https://moov.io/blog/">Blog</a> <br> <br> </p>

GoDoc Build Status Go Report Card Repo Size Apache 2 License Slack Channel Docker Pulls GitHub Stars Twitter

moov-io/ach

Moov's mission is to give developers an easy way to create and integrate bank processing into their own software products. Our open source projects are each focused on solving a single responsibility in financial services and designed around performance, scalability, and ease of use.

ACH implements a reader, writer, and validator for Automated Clearing House (ACH) files following the Nacha standards. ACH is the primary method of electronic money movement throughout the United States. The HTTP server is available in a Docker image and the Go package github.com/moov-io/ach is available.

If you're looking for an event driven ACH engine for uploading/downloading files and operations we have built moov-io/achgateway and run it in production. Our article How and When to use the Moov ACH Library will help to generate ACH files for upload to your ODFI.

Table of contents

Project status

Moov ACH is actively used in multiple production environments. Please star the project if you are interested in its progress. The project supports generating and parsing all Standard Entry Class (SEC) codes and validating files according to the Nacha standards. If you have layers above ACH to simplify tasks, perform business operations, or found bugs we would appreciate an issue or pull request. Thanks!

Usage

The ACH project implements an HTTP server and Go library for creating and modifying ACH files. There are client libraries available for both Go and Node/JavaScript. We also have an extensive list of examples of the reader and writer applied to various ACH transaction types.

Docker

We publish a public Docker image moov/ach from Docker Hub or use this repository. No configuration is required to serve on :8080 and metrics at :9090/metrics in Prometheus format. We also have Docker images for OpenShift published as quay.io/moov/ach.

Pull & start the Docker image:

docker pull moov/ach:latest
docker run -p 8080:8080 -p 9090:9090 moov/ach:latest

List files stored in-memory:

curl localhost:8080/files
{"files":[],"error":null}

Create a file on the HTTP server:

curl -X POST --data-binary "@./test/testdata/ppd-debit.ach" http://localhost:8080/files/create
{"id":"<YOUR-UNIQUE-FILE-ID>","error":null}

Read the ACH file (in JSON form):

curl http://localhost:8080/files/<YOUR-UNIQUE-FILE-ID>
{"file":{"id":"<YOUR-UNIQUE-FILE-ID>","fileHeader":{"id":"","immediateDestination":"231380104","immediateOrigin":"121042882", ...

Google Cloud Run button

To get started in a hosted environment you can deploy this project to the Google Cloud Platform.

From your Google Cloud dashboard create a new project and call it:

moov-ach-demo

Click the button below to deploy this project to Google Cloud.

Run on Google Cloud

Note: If you get an error about the image being marked as "Do Not Trust" follow the below steps.

<details> <summary>Error: You launched this custom Cloud Shell image as "Do not trust"</summary>
$ cloudshell_open --repo_url "https://github.com/moov-io/ach" --page "shell" --git_branch "master"
Error: You launched this custom Cloud Shell image as "Do not trust".
In this mode, your credentials are not available and this experience
cannot deploy to Cloud Run. Start over and "Trust" the image.
Error: aborting due to untrusted cloud shell environment

This error occurs when some security settings on your account / cloud shell are locked down. To run ACH you need to trust the image, so in the top-right click to restart this image as Trusted.

Click to "Return to default"

Then you'll need to clone down and launch ACH. Pick option #3 to clone this project.

cloudshell_open --repo_url "https://github.com/moov-io/ach" --page "shell" --git_branch "master"

Start the ACH server inside the cloned repository.

go run ./cmd/serverr

Connect to the web preview (e.g. https://YOUR-ACH-APP-URL.a.run.app:8080/files)

<hr /> <!-- end the details section --> </details>

In the cloud shell you should be prompted with:

Choose a project to deploy this application:

Using the arrow keys select:

moov-ach-demo

You'll then be prompted to choose a region, use the arrow keys to select the region closest to you and hit enter.

Choose a region to deploy this application:

Upon a successful build you will be given a URL where the API has been deployed:

https://YOUR-ACH-APP-URL.a.run.app

From the cloud shell you need to cd into the ach folder:

cd ach

Now you can list files stored in-memory:

curl https://YOUR-ACH-APP-URL.a.run.app/files

You should get this response:

{"files":[],"error":null}

Create a file on the server:

curl -X POST --data-binary "@./test/testdata/ppd-debit.ach" https://YOUR-ACH-APP-URL.a.run.app/files/create

You should get this response:

{"id":"<YOUR-UNIQUE-FILE-ID>","error":null}

Finally, read the contents of the file you've just posted:

curl https://YOUR-ACH-APP-URL.a.run.app/files/<YOUR-UNIQUE-FILE-ID>

You should get this response:

{"file":{"id":"<YOUR-UNIQUE-FILE-ID>","fileHeader":{"id":"...","immediateDestination":"231380104","immediateOrigin":"121042882", ...

HTTP API

The package github.com/moov-io/ach/server offers an HTTP and JSON API for creating and editing files. If you're using Go the ach.File type can be used, otherwise you can send properly formatted JSON. We have an example JSON file, but each SEC type will generate different JSON.

Examples: Go | Ruby

Configuration settings

Environmental VariableDescriptionDefault
ACH_FILE_TTLTime to live (TTL) for *ach.File objects stored in the in-memory repository.0 = No TTL / Never delete files (Example: 240m)
LOG_FORMATFormat for logging lines to be written as.Options: json, plain - Default: plain
HTTP_BIND_ADDRESSAddress for ACH to bind its HTTP server on. This overrides the command-line flag -http.addr.Default: :8080
HTTP_ADMIN_BIND_ADDRESSAddress for ACH to bind its admin HTTP server on. This overrides the command-line flag -admin.addr.Default: :9090
HTTPS_CERT_FILEFilepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP.Empty
HTTPS_KEY_FILEFilepath of a private key matching the leaf certificate from HTTPS_CERT_FILE.Empty

Data persistence

By design ACH does not persist (save) any data about the files, batches, or entry details created. The only storage occurs in memory of the process and upon restart ACH will have no files, batches, or data saved. Also, no in memory encryption of the data is performed.

Go library

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help in setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

# Pull down into the Go Module cache
$ go get -u github.com/moov-io/ach

# Show the documentation for the BatchHeader package
$ go doc github.com/moov-io/ach BatchHeader

The package github.com/moov-io/ach offers a Go-based ACH file reader and writer. To get started, check out a specific example:

<details> <summary>Supported Standard Entry Class (SEC) codes</summary>
SEC CodeDescriptionExampleReadWrite
ACKAcknowledgment Entry for CCDCreditACK ReadACK Write
ADVAutomated Accounting AdvicePrenote DebitADV ReadADV Write
ARCAccounts Receivable EntryDebitARC ReadARC Write
ATXAcknowledgment Entry for CTXCreditATX ReadATX Write
BOCBack Office ConversionDebitBOC ReadBOC Write
CCDCorporate credit or debitDebitCCD ReadCCD Write
CIECustomer-Initiated EntryCreditCIE ReadCIE Write
CORAutomated Notification of Change(NOC)NOCCOR ReadCOR Write
CTXCorporate Trade ExchangeDebitCTX ReadCTX Write
DNEDeath Notification EntryDNEDNE ReadDNE Write
ENRAutomatic Enrollment EntryENRENR ReadENR Write
IATInternational ACH TransactionsCreditIAT ReadIAT Write
MTEMachine Transfer EntryCreditMTE ReadMTE Write
POPPoint of PurchaseDebitPOP ReadPOP Write
POSPoint of SaleDebitPOS ReadPOS Write
PPDPrearranged payment and depositsDebit CreditPPD ReadPPD Write
RCKRepresented Check EntriesDebitRCK ReadRCK Write
SHRShared Network EntryDebitSHR ReadSHR Write
TELTelephone-Initiated EntryDebitTEL ReadTEL Write
TRCTruncated Check EntryDebitTRC ReadTRC Write
TRXCheck Truncation Entries ExchangeDebitTRX ReadTRX Write
WEBInternet-initiated EntriesCreditWEB ReadWEB Write
XCKDestroyed Check EntryDebitXCK ReadXCK Write
</details> <details> <summary>Segment Files</summary>
SEC CodeNameExampleReadWrite
IATInternational ACH TransactionsCreditIAT ReadIAT Write
PPDPrearranged payment and depositsDebit CreditPPD ReadPPD Write
</details>

Command line

On each release there's an achcli utility released. This tool can display ACH files in a human-readable format which is easier to read than their plaintext format. It also allows masking DFIAccountNumber values with the -mask flag.

Download the latest release for your computer

$ achcli test/testdata/ppd-debit.ach
Describing ACH file 'test/testdata/ppd-debit.ach'

  Origin     OriginName    Destination  DestinationName       FileCreationDate  FileCreationTime
  121042882  My Bank Name  231380104    Federal Reserve Bank  190624            0000

  BatchNumber  SECCode  ServiceClassCode  CompanyName      DiscretionaryData  Identification  EntryDescription  DescriptiveDate
  1            PPD      225 (Debits Only)  Name on Account                     121042882       REG.SALARY

    TransactionCode   RDFIIdentification  AccountNumber      Amount     Name                    TraceNumber      Category
    27 (Checking Debit)  23138010            12345678           100000000  Receiver Account Name   121042880000001

  ServiceClassCode  EntryAddendaCount  EntryHash  TotalDebits  TotalCredits  MACCode  ODFIIdentification  BatchNumber
  225 (Debits Only)  1                  23138010   100000000    0                      12104288            1

  BatchCount  BlockCount  EntryAddendaCount  TotalDebitAmount  TotalCreditAmount
  1           1           1                  100000000         0

In-browser ACH file parser

Using our in-browser utility, you can instantly convert ACH files into JSON. Either paste in ACH file content directly or choose a file from your local machine. This tool is particularly useful if you're handling sensitive PII or want perform some quick tests, as operations are fully client-side with nothing stored in memory.

SDKs

Below are some SDKs generated from the API documentation:

Learn about ACH

FAQ

<details open="true"> <summary ><b>Is there an in-browser tool for converting ACH files into JSON?</b></summary> Yes! You can find our browser utility at <a href="http://oss.moov.io/ach/">http://oss.moov.io/ach/</a>. </details> <details open="true"> <summary><b>Is my data being saved somewhere?</b></summary> No, we do not save any data related to files, batch, or entry details. All processing is done in-memory. </details> <details open="true"> <summary><b>What ACH transaction types are supported?</b></summary> We support generating and parsing all Standard Entry Class (SEC) codes. </details> <details open="true"> <summary><b>Where can I find the official Nacha Operating Rules?</b></summary> You can purchase the most recent Nacha Operating Rules and Guidelines resource directly from their <a href="https://www.nacha.org/store">webstore</a>. Additionally, Nacha has published a <a href="https://dev-ach-guide.pantheonsite.io/">free ACH guide for developers</a>. </details>

Getting help

If you have ACH-specific questions, NACHA (National Automated Clearing House Association) has their complete specification for all file formats and message types.

channelinfo
Project DocumentationOur project documentation available online.
Twitter @moovYou can follow Moov.io's Twitter feed to get updates on our project(s). You can also tweet us questions or just share blogs or stories.
GitHub IssueIf you are able to reproduce a problem please open a GitHub Issue under the specific project that caused the error.
moov-io slackJoin our slack channel to have an interactive discussion about the development of the project.

Supported and tested platforms

Note: 32-bit platforms have known issues and are not supported.

Contributing

Yes please! Please review our Contributing guide and Code of Conduct to get started! Check out our issues for first time contributors for something to help out with.

This project uses Go Modules and Go v1.18 or newer. See Golang's install instructions for help setting up Go. You can download the source code and we offer tagged and released versions as well. We highly recommend you use a tagged release for production.

Releasing

To make a release of ach simply open a pull request with CHANGELOG.md and version.go updated with the next version number and details. You'll also need to push the tag (i.e. git push origin v1.0.0) to origin in order for CI to make the release.

Testing

We maintain a comprehensive suite of unit tests and recommend table-driven testing when a particular function warrants several very similar test cases. To run all test files in the current directory, use go test.

Fuzzing

We currently run fuzzing over ACH in the form of a Github Action. Please report crashes examples to oss@moov.io. Thanks!

Related projects

As part of Moov's initiative to offer open source fintech infrastructure, we have a large collection of active projects you may find useful:

License

Apache License 2.0 - See LICENSE for details.