DOCS
Build with the API

Accept an ACH debit

Debit a US bank account with a token, or with the ach object on pay.

Platform guide

POST /v1/transactions/pay debits a US bank account when you send an ach object, or the tokenId of a saved ACH account.

The request

  • The ach object requires bankAccountHolder, a 9-digit routingNumber, and accountNumber. bankAccountType is optional and is one of PersonalSavings, PersonalChecking, CorporateSavings, or CorporateChecking.
  • amount is the total debited, including any payer fee.
  • payer and payerFee are required. Send 0 for payerFee when there is no payer fee.

To save the account for later, tokenize it first with POST /v1/tokens, then pay with tokenId and no ach object. You can validate the account as you save it by setting validateAccount, or beforehand with Validate a bank account.

pay-ach
curl -s -u "$DHANGO_KEY:$DHANGO_SECRET" \ -H "Content-Type: application/json" \ -H "accountKey: $ACCOUNT_KEY" \ -d '{"payer":"Ada Lovelace","amount":40.00,"payerFee":0,"ach":{"bankAccountHolder":"Ada Lovelace","routingNumber":"021000021","accountNumber":"123456789","bankAccountType":"PersonalChecking"}}' \ https://api.dhangodemo.com/v1/transactions/pay

After the call

An ACH debit is not final when pay returns. The payment still has to be sent to the bank and funded, and the payer's bank can return it days later. Follow it with GET /v1/transactions/{id} or TransactionEvent webhooks. Transaction lifecycles shows the sequence of events.

Testing

On the Fake processor, an account number ending in 0801 is returned (R01) before batching, and one ending in 1801 is returned after batching. Any other account number with a valid routing number succeeds. See Test cards and bank accounts.