Hey! These docs are for version 1.0, which is no longer officially supported. Click here for the latest version, 1.1!

Simulating an ACH Return

When creating an ACH payment order through Gringotts, it is possible to set up the payment so that it will eventually trigger a return. When creating the payment order, its counterparty must have an account number as 100XX where XX is the return code you wish to trigger. For example, if the receiving account number is 10001, you will receive an R01 return (Insufficient funds) which will be posted within minutes after the original payment orders have been sent to the bank. This mirrors how ACH returns work in the real world, since your bank will mark the payment order as completed but any returns will come after the fact.

curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/counterparties \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "Kenner, Bach and Ledeen",
  "accounts": [
    {
      "account_type": "checking",
      "routing_details": [
        {
          "routing_number_type": "aba",
          "routing_number": "121141822"
        }
      ],
      "account_details": [
        {
          "account_number": "10001"
        }
      ]
    }
  ]}'

# Returns with an External Account with ID: 5acec2ef-987b-4260-aa97-b719eeb0a8d5
  
curl --request POST \
  -u ORGANIZATION_ID:API_KEY \
  --url https://app.moderntreasury.com/api/payment_orders \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "ach",
  "amount": 1000,
  "direction": "credit",
  "currency": "USD",
  "originating_account_id": "0f8e3719-3dfd-4613-9bbf-c0333781b59f",
  "receiving_account_id": "5acec2ef-987b-4260-aa97-b719eeb0a8d5"
}'

For more on ACH Return codes, see ACH Return/NOC Codes.