Skip to content
Select theme

Handle ACH returns, NOCs, and clawbacks

This guide shows you how to handle the ACH exceptions that arrive after a payment has started: a return on the debit from the payer, a return on the payout to the payee, and a Notice of Change (NOC) on a bank account. You detect each one, look up its details, decide what to do next from the return code, and follow the clawback or reverse payout that GrailPay starts on your behalf.

GrailPay moves the money for you in each case. Your integration’s job is to keep your own records in step, tell the right person, and avoid sending a new payment that fails for the same reason. For background on why returns happen and how they relate to settlement timing, see ACH Returns in the Payments Platform Overview.

Before you start, you need:

  • An API key for the environment you are working in. See Authentication and Environments.
  • A registered webhook URL. Every registered URL receives every event, so there is nothing extra to subscribe to. See Manage Webhooks, and Receive and verify webhook events for the handler that receives them.
  • A way to store each transaction’s uuid against your own record of the payment, so that you can match an event to the payment it concerns.

A transaction has two legs: the capture debits the payer, and the payout credits the payee. Where a return lands, and when, decides what GrailPay does automatically.

What happened What GrailPay does automatically Events you receive
The debit is returned before the payout Marks the transaction CAPTURE_ACH_FAILED, sends no payout, and cancels any pending refunds on the transaction. transaction.failed
The debit is returned after the payout Marks the transaction CAPTURE_ACH_FAILED, then creates a clawback that debits the payee to recover the payout. transaction.failed, then clawback.created, clawback.processing, and clawback.completed or clawback.failed
The payout is returned Marks the payout PAYOUT_ACH_FAILED and creates a reverse payout that credits the funds back to the payer. payout.failed, then reverse_payout.created, reverse_payout.processing, and reverse_payout.completed or reverse_payout.failed
The payer’s or payee’s bank sends a NOC Updates the bank account’s details in place. The payment that prompted the NOC still settles. noc.received, then noc.processed

The full list of states for each of these flows is in Transaction States & Events.

In your webhook handler, branch on the event field and send each exception event to the code that handles it. Ignore the others or pass them to your existing handlers.

event Payment it concerns Go to
transaction.failed data.transaction.uuid Step 2
payout.failed data.payout.uuid Step 2
clawback.created, clawback.processing, clawback.completed, clawback.failed data.relations.transaction.uuid Step 4
reverse_payout.created, reverse_payout.processing, reverse_payout.completed, reverse_payout.failed, reverse_payout.cancelled data.relations.transaction.uuid Step 5
noc.received, noc.processed data.bank_account_uuid Step 6

The payload of every event is on its own page under Webhook Events.

When transaction.failed or payout.failed arrives, fetch the return record. It brings the return code, the leg it happened on, and every related object together in one response. Filter GET /api/v3/returns by the UUID from the event:

cURL
curl --location 'https://api-sandbox.grailpay.com/api/v3/returns?filter[transaction_uuid]={TRANSACTION_UUID}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}'

For a payout return, filter by filter[payout_uuid]={PAYOUT_UUID} instead.

Each record in data.returns has these fields to act on:

Field What it tells you
leg capture when the debit from the payer was returned, payout when the credit to the payee was returned.
transaction.ach_return_code, transaction.ach_return_code_description The return code and its title, on a capture-leg return. For example, R01 and Insufficient Funds.
payout.ach_return_code, payout.ach_return_code_description The return code and its title, on a payout-leg return.
clawback The clawback GrailPay created, when the payee had already been paid. Otherwise null.
reverse_payout The reverse payout GrailPay created, when the payout was returned. Otherwise null.
entity The person or business whose bank account was returned: the payer on the capture leg, the payee on the payout leg.

Store the return code against your record of the payment, and mark the payment as failed in your own system. The transaction.failed payload also carries ach_return_code, but the return record is the one place that shows both legs and every related object. For every filter and field, see List Returns and the Get All Returns reference.

Step 3: Decide the next action from the return code

Section titled “Step 3: Decide the next action from the return code”

The return code tells you whether you can try the same bank account again. Find the code in this table and take the action in the last column before you create another transaction for the same payer.

Category Codes What it means What to do
Funds not available R01, R09 The account exists, but did not hold enough collected funds. Tell the payer, then create a new transaction. Nacha rules allow two more attempts within 180 days of the original settlement date.
Account cannot be used R02, R03, R04, R12, R13, R20 The account is closed, cannot be found, or cannot take ACH debits. Do not debit this account again. Collect a different account from the payer, add it, then create the new transaction with its UUID as source_bank_account_uuid.
Payer stopped or disputes the debit R05, R07, R08, R10, R11, R29 The payer did not authorize this debit, revoked authorization, or stopped the payment. Stop debiting this payer. Contact them, and debit again only after you obtain a new authorization.
Account holder deceased or account frozen R14, R15, R16 The account must not be debited again. Stop all debits to this account and contact support@grailpay.com.
Other codes For example, R06, R17, R23, R24 A bank-side or technical reason. Contact support@grailpay.com with the transaction UUID and the trace ID from bank_identifiers before you retry.

The titles and time frames of every code are in Return Codes.

On a payout-leg return, apply the same table to the payee instead: the payee’s account is the one that was returned. Ask the payee for a working account before you send them another payment.

If you code this decision, keep the mapping in one place so that support and engineering read the same rules. Each example returns retry for R01, collect_new_account for R03, and obtain_new_authorization for R10.

app/Support/ReturnAction.php
namespace App\Support;
// Map an ACH return code to the next action for that bank account.
class ReturnAction
{
private const RETRY_ALLOWED = ['R01', 'R09'];
private const NEW_ACCOUNT_NEEDED = ['R02', 'R03', 'R04', 'R12', 'R13', 'R20'];
private const NEW_AUTHORIZATION_NEEDED = ['R05', 'R07', 'R08', 'R10', 'R11', 'R29'];
private const STOP_AND_CONTACT_SUPPORT = ['R14', 'R15', 'R16'];
public static function for(string $returnCode): string
{
return match (true) {
in_array($returnCode, self::RETRY_ALLOWED, true) => 'retry',
in_array($returnCode, self::NEW_ACCOUNT_NEEDED, true) => 'collect_new_account',
in_array($returnCode, self::NEW_AUTHORIZATION_NEEDED, true) => 'obtain_new_authorization',
in_array($returnCode, self::STOP_AND_CONTACT_SUPPORT, true) => 'stop_and_contact_support',
default => 'contact_support',
};
}
}

A clawback starts when the debit from the payer is returned after the payee has already been paid. GrailPay creates it automatically, so you do not call any endpoint to start it. The clawback debits the payee’s bank account for the transaction amount less the transaction fee.

  1. On clawback.created, tell the payee that a debit is coming and why. The payload’s data.clawback.amount is the amount in cents, and data.relations.transaction.uuid identifies the original transaction.
  2. On clawback.processing, record that the debit is in progress. The clawback’s status is CLAWBACK_ACH_PENDING.
  3. On clawback.completed, mark the payment as reversed in your records. The funds are recovered, and the transaction’s status becomes CLAWBACK.
  4. On clawback.failed, the debit from the payee was itself returned, and the funds are not recovered. Read data.clawback.ach_return_code, and contact support@grailpay.com with the clawback UUID.

To check a clawback’s state at any time, fetch it with GET /api/v3/clawbacks/{uuid}, or list every clawback for one transaction:

cURL
curl --location 'https://api-sandbox.grailpay.com/api/v3/clawbacks?filter[transaction_uuid]={TRANSACTION_UUID}' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}'

A transaction can have more than one clawback. Each record’s clawback_type is transaction or vendor_fee, which tells them apart. The filters are listed under Clawbacks in Manage Transactions.

A reverse payout starts when the credit to the payee is returned, for example because the payee’s account is closed. GrailPay creates it automatically and credits the funds back to the payer. If the debit from the payer has also been returned, GrailPay does not create a reverse payout, because there are no funds to send back.

  1. On reverse_payout.created, record that the payee was not paid and that the funds are on their way back to the payer.
  2. On reverse_payout.completed, mark the payment as returned to the payer.
  3. On reverse_payout.failed, contact support@grailpay.com with the reverse payout UUID.
  4. On reverse_payout.cancelled, GrailPay stopped the reverse payout before it completed, and no funds go back to the payer. This happens when the debit from the payer is returned after the reverse payout was created. The payload’s cancel_reason says why. See Reverse Payout Events.

Then apply the return code from Step 3 to the payee’s bank account. To pay the payee, collect a working account from them, add it, and create a new transaction with that account’s UUID as destination_bank_account_uuid. If the payee is a merchant configured for batch payouts, set the new account as the merchant’s default instead, because batch payouts always go to the default account. See Destination Account & Batch Payouts.

To look up reverse payouts, use GET /api/v3/reverse-payouts or GET /api/v3/reverse-payouts/{uuid}.

Step 6: Keep bank account details current after a NOC

Section titled “Step 6: Keep bank account details current after a NOC”

A NOC is not a failed payment. The payer’s or payee’s bank accepted the entry and is telling GrailPay that some of the account details have changed, such as the account number, the routing number, or the account type. Nacha rules require the change to be applied within six banking days, and GrailPay applies it for you.

  1. On noc.received, no action is needed. The payload shows the old values (old_account_number, old_routing_number, old_account_name, old_account_type) and the corrected values.
  2. On noc.processed, GrailPay has updated the bank account. The bank_account_uuid stays the same, so transactions that reference it, or that use the default account, use the corrected details from now on. If you keep your own copy of the account details, such as the last four digits shown to the account holder, update it from the corrected values in the payload.

If GrailPay cannot apply a change automatically, it contacts you so that you can resolve it together. Until then, you receive noc.received without a matching noc.processed.

Check your records against GrailPay’s once a day. List every return in a date range and compare it with the payments you have marked as returned:

cURL
curl --location 'https://api-sandbox.grailpay.com/api/v3/returns?filter[start_date]=2026-11-16&filter[end_date]=2026-11-16&sort=-ach_failed_at' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {YOUR_API_KEY}'

Your handling is complete when:

  • Every transaction or payout in the response is marked as returned in your system, with its return code.
  • Every record with a non-null clawback or reverse_payout has a matching status in your records.
  • No payment in your system is marked as returned without a matching record in the response.

The dates are matched against the date of the ACH failure, in YYYY-MM-DD format. Add filter[leg]=capture or filter[leg]=payout to check one leg at a time.

Problem Cause and fix
GET /api/v3/returns returns nothing for a transaction you know failed. Check that you used the right filter: filter[transaction_uuid] for a debit return, filter[payout_uuid] for a payout return. Leave out filter[leg] to search both legs.
A new transaction to the same payer fails with the same return code. The original code needed a new account or a new authorization, not a retry. Check the code against the table in Step 3.
transaction.failed arrives with ach_return_code set to null. The debit failed without a return code from the payer’s bank. Fetch the transaction with GET /api/v3/transactions/{uuid}, and contact support with its UUID if the reason is unclear.
A clawback stays in CLAWBACK_ACH_PENDING. The debit from the payee is still moving through the ACH network. Wait for clawback.completed or clawback.failed.
You did not receive any exception events. Check that your webhook registration is active. GrailPay deactivates a URL once 30 events in a row have each failed every delivery attempt. See Manage Webhooks.

If you have questions about a specific return, contact support@grailpay.com with the transaction UUID.

Maintained by EkLine