An ACH return code is the reason the receiving bank (the RDFI) sends an entry back. Each one is an R followed by two digits, and each comes with a deadline. For most codes the RDFI must get the return to your bank by opening of business on the second banking day after the settlement date (Community Banks of Colorado). For unauthorized debits to consumer accounts, the window is 60 calendar days (Column), and the RDFI needs a signed Written Statement from the account holder before it sends one (Community Banks of Colorado).
R01 (insufficient funds) is the common one on consumer debits, and one of only two codes you can simply send again: Nacha allows R01 and R09 to be reinitiated at most twice, within 180 days of the original entry's settlement date.
Return codes you'll receive on a debit
Names follow Nacha's for R10 and R11 (Nacha) and Modern Treasury's table for the rest. Deadlines are from Column, a national bank, and agree with Modern Treasury and the Community Banks of Colorado reference card. The last column follows that card and Nacha's rules.
| Code | Name | Deadline | Send it again? |
|---|---|---|---|
| R01 | Insufficient funds | 2 banking days | Yes: at most twice, within 180 days |
| R02 | Account closed | 2 banking days | No. Ask for another account |
| R03 | No account / unable to locate account | 2 banking days | No. Ask for correct details |
| R04 | Invalid account number structure | 2 banking days | Not until the number is fixed |
| R05 | Unauthorized debit to consumer account using corporate SEC code | 60 calendar days | No. Stop debiting the account |
| R06 | Returned per ODFI's request | No fixed deadline | No. Your side asked for it |
| R07 | Authorization revoked by customer | 60 calendar days | Not without a new authorization |
| R08 | Payment stopped | 2 banking days | Only with a new authorization |
| R09 | Uncollected funds | 2 banking days | Yes: as R01 |
| R10 | Customer advises originator is not known and/or not authorized to debit the account | 60 calendar days | No. Stop debiting the account |
| R11 | Customer advises entry not in accordance with the terms of the authorization | 60 calendar days | Yes, corrected, within 60 days of the return |
| R12 | Account sold to another DFI | 2 banking days | With the new routing number |
| R14 | Representative payee deceased or unable to continue | 2 banking days | No |
| R15 | Beneficiary or account holder deceased | 2 banking days | No |
| R16 | Account frozen / entry returned per OFAC instruction | 2 banking days | No |
| R17 | File record edit criteria, questionable entry, or improperly initiated reversal | 2 banking days | Fix the fields first; investigate if marked QUESTIONABLE |
| R20 | Non-transaction account | 2 banking days | No. Ask for another account |
| R21 | Invalid company identification | 2 banking days | Fix the ID first |
| R22 | Invalid individual ID number | 2 banking days | Fix the ID first |
| R23 | Credit entry refused by receiver | When the receiver refuses | Credits only; get authorization first |
| R24 | Duplicate entry | 2 banking days | No, if it really was a duplicate |
| R29 | Corporate customer advises not authorized | 2 banking days | Not without a new authorization |
| R31 | Permissible return entry (CCD and CTX only) | No fixed deadline | As agreed with the RDFI |
| R33 | Return of XCK entry | 60 calendar days | Ask your bank (XCK entries only) |
| R37 | Source document presented for payment (ARC, BOC, POP) | 60 calendar days | No. The check was paid instead |
| R38 | Stop payment on source document (ARC, BOC) | 60 calendar days | Only with a new authorization |
| R39 | Improper source document / source document presented for payment | 2 banking days | No |
| R51 | Item related to RCK entry is ineligible or improper | 60 calendar days | No |
| R52 | Stop payment on item related to RCK entry | 60 calendar days | Only with a new authorization |
| R53 | Item and RCK entry presented for payment | 60 calendar days | No |
The deadline is the RDFI's, not yours. It tells you how long a debit stays open after it settles: two banking days for most codes, two months for the unauthorized ones. Stripe puts the same split in customer terms: up to 60 calendar days to dispute a debit on a personal account, up to two business days on a business account (Stripe). That's why R10 (consumer) and R29 (business) look alike but carry different windows.
The retry rules
Nacha calls a retry a reinitiation, and allows very few of them.
- R01 and R09: reinitiate at most twice after the original, within 180 days of the original entry's settlement date (Community Banks of Colorado). The company name, company ID and amount must be identical to the original, and the Company Entry Description must say
RETRY PYMT(Nacha). A different amount, higher or lower, is improper. - R08: contact the customer and get a new authorization first (Community Banks of Colorado).
- R11: correct the error and send a new entry within 60 days of the R11 return's settlement date, without a new authorization (Nacha).
- R05, R07, R10, R29: reinitiating an entry returned as unauthorized is improper. A new authorization obtained after the return makes the next debit a new payment rather than a reinitiation, but you can't collect that approval in advance to get around the rule. An improperly reinitiated debit can itself come back as R10 (Nacha).
- Everything else: fix the cause (new account, corrected number, new routing number) before anything is sent.
The next debit in a recurring series isn't a reinitiation, as long as it isn't triggered by the earlier one being returned (Nacha). If you collect through Stripe, it can retry insufficient-funds ACH debits for you, at most twice and no more than 40 days after the original attempt, without the failure fee (Stripe).
Returns from the ACH Operator
These come back for problems in the file itself, usually before the customer's bank sees anything. Modern Treasury gives the deadline for each as the next file delivery time following processing (Modern Treasury). The fix is in your file or your bank's, never in a retry of the same data.
| Code | Name |
|---|---|
| R13 | Invalid ACH routing number |
| R18 | Improper effective entry date |
| R19 | Amount field error |
| R25 | Addenda error |
| R26 | Mandatory field error |
| R27 | Trace number error |
| R28 | Routing number check digit error |
| R30 | RDFI not participant in check truncation program |
| R32 | RDFI non-settlement |
| R34 | Limited participation DFI |
| R35 | Return of improper debit entry |
| R36 | Return of improper credit entry |
Dishonored and contested returns
When a return itself is wrong (late, misrouted, a duplicate), your bank can send it back as a dishonored return, within 5 banking days of the return's settlement date. The RDFI can then answer with a contested dishonored return within 2 banking days (Community Banks of Colorado, Column).
| Code | Dishonored return | Code | Contested dishonored return |
|---|---|---|---|
| R61 | Misrouted return | R71 | Misrouted dishonored return |
| R62 | Return of erroneous or reversing debit | R72 | Untimely dishonored return |
| R67 | Duplicate return | R73 | Timely original return |
| R68 | Untimely return | R74 | Corrected return |
| R69 | Field error(s) | R75 | Return not a duplicate |
| R70 | Permissible return entry not accepted / return not requested by ODFI | R76 | No errors found |
| R77 | Non-acceptance of R62 dishonored return |
R68 is the one worth automating: a return that arrives after its deadline is one you can dishonor, and the deadline is in the first table.
International (IAT) returns
Gateway operators use R80 to R85 for international entries: IAT entry coding error, non-participant in IAT program, invalid foreign RDFI identification, foreign RDFI unable to settle, entry not processed by gateway, and incorrectly coded outbound international payment (Modern Treasury, Stripe). The deadlines differ between the published tables we checked, so they're left out here. Ask your bank.
In code
The retry decision, as a function. It reads the code before the calendar, and counts reinitiations per original entry, not per customer.
from datetime import date, timedelta
REINITIATE = {"R01", "R09"} # twice at most, within 180 days
UNAUTHORIZED = {"R05", "R07", "R10", "R29"} # never reinitiate
NEW_DETAILS = {"R02", "R03", "R04", "R12", "R20"}
STOP = {"R14", "R15", "R16"}
def handle_return(code, original_settled, retries_so_far, today):
"""What to do with an ACH debit that came back with `code`."""
if code in REINITIATE:
if retries_so_far >= 2:
return "stop: two reinitiations already"
if today > original_settled + timedelta(days=180):
return "stop: more than 180 days since the original settled"
return "reinitiate: same company name, ID and amount, 'RETRY PYMT'"
if code == "R11":
return "fix the error and send a corrected entry within 60 days"
if code == "R08":
return "ask the customer why; send again only with a new authorization"
if code in UNAUTHORIZED:
return "stop debiting this account; a new debit needs a new authorization"
if code in NEW_DETAILS:
return "ask the customer for new bank details"
if code in STOP:
return "stop debiting this account"
return "hold and investigate before anything else is sent"
print(handle_return("R01", date(2026, 11, 3), 0, date(2026, 11, 14)))
For return-rate thresholds (unauthorized, administrative and overall), see Nacha rules. For the Stripe side, where these arrive as failed payments and disputes, see accepting ACH payments.
Why return codes are where most ACH integrations break, and the four you'll meet first. From chapter 6.
ACH: The US Workhorse
ACH (Automated Clearing House) handles most US electronic payments - payroll, bill pay, B2B settlements, and a fast-growing share of consumer-to-business payments. The numbers are large: ACH moved $93 trillion across 35.2 billion payments in 2025 (Nacha). US general-purpose card payments, by comparison, came to $9.76 trillion in 2022, the latest year in the Federal Reserve Payments Study.
How it works. ACH is a batch system run by NACHA (the rule-making body) and operated by the Federal Reserve and The Clearing House. You submit a batch file containing debit/credit instructions; the network sorts them, sends them to the receiving banks, and settles in 1-2 business days for standard ACH or same-day for Same-Day ACH (three submission windows a day, the last closing at 16:45 ET, per Nacha).
Pricing. ACH is priced far below cards. Stripe charges 0.8% capped at $5 for ACH Direct Debit against 2.9% + $0.30 for a domestic card (Stripe, 2026), so a $1,000 payment costs $5 by ACH and $29.30 by card. Why doesn't everyone use ACH? Two reasons: (1) consumer ACH requires bank account + routing number, which is more friction than tapping a card; (2) ACH transactions can be reversed (returned) up to 60 days for unauthorized debits, which is a fraud risk for high-value or anonymous-customer transactions.
Return codes. This is where most ACH integrations break. R01 (insufficient funds), R02 (closed account), R03 (no account/unable to locate), R10 (customer says unauthorized) are the common ones. Build return-code handling from day one - dispute handling, customer notifications, and dunning all hinge on it.
Micro-deposits for verification. Before debiting a bank account, confirm ownership by sending two small (under $1) deposits and asking the customer to verify the amounts. Plaid and similar services replace this with API-driven instant verification, but micro-deposits remain the fallback when Plaid coverage doesn't reach.
Same-Day ACH is your friend for time-sensitive payments. Your bank charges a premium for it, and how much varies by bank, so ask before you assume. The settlement difference (hours vs days) is huge for customer experience. Default to Same-Day for refunds and B2B.
Implementation: src/examples/6-international-payments-multi-currency/cross_border_payments.py
The NACHA file you send, and the return handling that answers it. From chapter 32.
ACH: The Workhorse of B2B
ACH (Automated Clearing House) moved $93 trillion across 35.2 billion payments in the US in 2025, and about 8.1 billion of those were business-to-business (Nacha). It's slow, it's boring, and it's the rail you'll spend the most code on.
The processor below builds the NACHA file your bank's origination system expects: a file header, a batch header per transaction class, the entry detail records, and the control totals. The classes are PPD for consumers, CCD for corporate, CTX when the payment needs addenda records carrying invoice detail, and WEB for internet authorizations. Get a control total off by a cent and the bank bounces the whole file. The processor also handles what comes back, because a NACHA file is a conversation: returns arrive with a code, and the code decides whether you retry, revoke, or pick up the phone.
from datetime import datetime
from decimal import Decimal
class ACHPaymentProcessor:
"""
Generate NACHA-formatted ACH files for batch payments
ACH Network: $93T across 35.2B payments in 2025 (Nacha)
"""
def create_ach_file(self, payments: list, batch_type: str):
"""
Generate NACHA file with proper structure:
- File Header Record (1 record): Priority code, routing validation
- Batch Header Records: PPD/CCD/CTX/WEB transaction types
- Entry Detail Records: 94-char fixed-width (routing, account, amount)
- Addenda Records: Invoice numbers, remittance data
- Batch Control Records: Hash totals, debit/credit sums
- File Control Records: Final totals
- Block Padding: 940-character blocks
"""
# File header (Record Type '1')
file_header = {
'record_type': '1',
'priority_code': '01',
'immediate_destination': self.routing_number, # 10 digits
'immediate_origin': self.company_id, # 10 digits
'file_creation_date': datetime.now().strftime('%y%m%d'),
'file_id_modifier': 'A', # A-Z for same-day files
}
# Batch header (Record Type '5')
batch_header = {
'record_type': '5',
'service_class_code': '200', # 200=mixed, 220=credits, 225=debits
'company_name': self.company_name,
'company_id': self.company_id,
'standard_entry_class': batch_type, # PPD, CCD, CTX, WEB
'batch_number': self.get_next_batch_number(),
}
# Entry details (Record Type '6') - 94 characters fixed-width
for payment in payments:
entry = {
'record_type': '6',
'transaction_code': '22', # 22=checking credit, 27=checking debit
'receiving_dfi': payment['routing'][:8], # First 8 of routing
'check_digit': payment['routing'][8], # 9th digit
'dfi_account': payment['account'].ljust(17), # 17 chars padded
'amount': str(int(payment['amount'] * 100)).zfill(10), # Cents, 10 digits
'individual_name': payment['recipient_name'][:22], # 22 chars max
'trace_number': f"{self.routing_number[:8]}{self.sequence:07d}",
}
# Addenda record (Record Type '7') for remittance info
if payment.get('invoice_numbers'):
addenda = {
'record_type': '7',
'addenda_type': '05',
'payment_data': f"INV: {','.join(payment['invoice_numbers'])}",
'sequence_number': '0001',
}
# Batch control (Record Type '8')
batch_control = {
'entry_hash': self.calculate_routing_hash(payments), # Sum of routing numbers
'total_debit': sum(p['amount'] for p in payments if p['type'] == 'debit'),
'total_credit': sum(p['amount'] for p in payments if p['type'] == 'credit'),
}
# Submit to NACHA network
# Standard: 1-2 business days
# Same-day: 10:30 AM, 2:45 PM, 4:45 PM ET cutoffs
return self.format_nacha_file(file_header, batch_header, entries, batch_control)
def handle_ach_returns(self, return_file):
"""
Process 60+ ACH return codes:
- R01/R09: Insufficient or uncollected funds -> Retry in 3-5 days,
at most twice within 180 days of the original settlement, same
amount, "RETRY PYMT" in the entry description (Nacha)
- R02/R03/R04: Account issues -> Contact customer for new banking info
- R05/R07/R10/R29: Authorization disputes -> Revoke ACH, never retry
- Customer flagging (NSF flags, authorization revoked)
"""
The snippets in this chapter are trimmed to the parts worth reading. The complete ACH and invoicing implementations are in the example files listed at the end of the chapter.
Questions
What is an ACH return code?
The reason the receiving bank sent an ACH entry back: an R followed by two digits, such as R01 for insufficient funds or R10 for an unauthorized debit. Each code has a deadline and decides whether the entry can be sent again.
What does ACH return code R01 mean?
R01 means insufficient funds: the available balance didn't cover the debit. It must be returned within 2 banking days, and Nacha allows the debit to be reinitiated at most twice, within 180 days of the original entry's settlement date, for the same amount, with RETRY PYMT in the Company Entry Description.
How long does a bank have to return an ACH debit?
For most codes, 2 banking days after settlement. Unauthorized debits to consumer accounts (R05, R07, R10) and R11 have 60 calendar days. A business account reporting an unauthorized debit uses R29, which has 2 banking days.
Which ACH returns can be retried?
R01 and R09 can be reinitiated at most twice within 180 days. R11 can be corrected and sent again within 60 days of the return. R08 needs a new authorization first. An entry returned as unauthorized (R05, R07, R10, R29) must not be reinitiated.
What is the difference between R10 and R29?
Both say the debit wasn't authorized. R10 is for consumer accounts and can arrive up to 60 calendar days later. R29 is for business accounts and has 2 banking days.