Skip to Content
Docs
Bank debits

ACH direct debit

Debit a customer's US bank account over ACH, or send a Request for Payment over RTP, from your server with POST /v1/charges.

ACH direct debit pulls USD from a customer's US checking or savings account. You create each charge from your server with the customer's bank details or a saved bank account, and send it over ACH or as a Request for Payment (RfP) over the RTP network.

Payment method properties

ACH direct debit takes USD from customers in the United States, and you accept it only through the API.

PropertyDetails
TypeBank debit
API typeus_bank_account
Customer countriesUnited States
CurrenciesUSD
Recurring paymentsYes
IntegrationsAPI

How it works

An ACH direct debit charge is asynchronous, so its outcome arrives after you create it.

  1. You collect the customer's authorization to debit their account, and their routing number, account number, and account type.
  2. You create the charge with POST /v1/charges. Every ACH direct debit charge returns 201 with status: "pending", including a charge that's declined later.
  3. Pay.com sends the charge over the rail you chose. The charge moves to succeeded or failed, and Pay.com sends the charge.succeeded or charge.failed webhook event.
  4. After a charge succeeds, the customer's bank can still return the debit. See Returns.

You must get the customer's authorization to debit their account before you create the charge, and send the notices the ACH rules require. Pay.com doesn't collect authorizations or send debit notices for you.

Before you begin

Ask your account manager to enable ACH direct debit for your account. Request for Payment needs its own setup, so tell them if you plan to send charges over RTP.

You also need:

Charge a bank account

Send POST /v1/charges with source_data.type set to "us_bank_account", the customer's bank details in source_data.us_bank_account, and the rail in payment_method_options.us_bank_account.network. The example debits $100.00, because amount is in minor units.

{
  "amount": 10000,
  "currency": "usd",
  "customer_reference_id": "cust-001",
  "source_data": {
    "type": "us_bank_account",
    "us_bank_account": {
      "account_number": "000123456789",
      "routing_number": "021000021",
      "account_holder_name": "Jane Smith",
      "account_type": "checking",
      "account_holder_type": "individual"
    },
    "billing_details": {
      "name": "Jane Smith",
      "email": "jane.smith@example.com",
      "address": {
        "line1": "1 Main Street",
        "city": "New York",
        "state": "NY",
        "postal_code": "10001",
        "country": "US"
      }
    }
  },
  "payment_method_options": {
    "us_bank_account": {
      "network": "ach",
      "ach_type": "same_day"
    }
  }
}

network and account_type are required, and a charge without network is declined. account_type is checking or savings, and account_holder_type is individual or company. billing_details needs at least the customer's name and email. A Request for Payment also needs the full billing address, including the street in address.line1.

Choose the rail

Set these options in payment_method_options.us_bank_account on the charge.

OptionValuesDescription
networkach, rtpRequired. The rail the charge uses. ach debits the account over ACH. rtp sends a Request for Payment over the RTP network, and the customer approves it with their bank. A charge with fednow is declined.
ach_typenext_day, same_dayHow fast an ACH debit settles. next_day, the default, settles the next business day. same_day settles the same business day.
ach_entryweb, ppd, ccd, telThe ACH entry class, which matches how the customer authorized the debit. web, the default, is for authorization online. ppd is for a consumer's written authorization, ccd is for a business account, and tel is for authorization by phone.
ach_fallbacktrue, falseFor a Request for Payment. Set to true to send the charge as a same-day ACH debit when the customer's bank can't receive Request for Payment, or when the billing address has no street. Without it, those charges are declined.

Charge a saved bank account

To charge a bank account the customer saved before, pass its pm_us_bank_account_… ID as payment_method, an alias of source, with the same customer_reference_id it was saved for. Set off_session to true when the customer isn't in your checkout, such as for a recurring charge. Each charge's network decides its rail, so you can charge a saved account over ACH or RTP.

{
  "amount": 10000,
  "currency": "usd",
  "customer_reference_id": "cust-001",
  "payment_method": "pm_us_bank_account_483260647404995584",
  "off_session": true,
  "payment_method_options": {
    "us_bank_account": {
      "network": "ach"
    }
  }
}

To find a saved bank account's ID, list the customer's payment methods with GET /v1/customers/{reference_id}/payment_methods.

Track the outcome

An ACH direct debit charge stays pending until its outcome arrives. Pay.com sends the outcome in a webhook event, and you can also retrieve the charge with GET /v1/charges/{id}. Don't fulfill an order while its charge is pending.

RailWhen the charge moves to succeeded
ACH with same_dayThe same business day
ACH with next_dayThe next business day
Request for PaymentWhen the customer pays the request

A declined charge moves to failed within a few seconds, with a failure_code such as processing_error, or issuer_not_available when the customer's bank can't receive Request for Payment. See Declines for what each code means.

Subscribe to these events, and verify the Pay-Signature header before you act on one. See Verify webhook signatures.

EventWhen it firesWhat to do
charge.succeededThe debit or the Request for Payment completedFulfill the order
charge.failedThe charge was declinedRead the charge's failure_code, and ask the customer to pay again or use another method

Returns

An ACH debit isn't guaranteed. After a charge succeeds, the customer's bank can still return the debit:

  • An administrative return, such as R01 for insufficient funds, usually arrives within 2 business days.
  • A return for a debit the customer says they didn't authorize can arrive up to 60 days later.

Pay.com records a return as a lost dispute, with the ACH return code as its reason, and takes back the charge's amount and a chargeback fee. See Disputes.

Test in the sandbox

Test with your sandbox API key (sk-pay-com-sandbox-...) against https://api.sandbox.pay.com/v1. Sandbox payments never move real funds. See Environments.

Any account number works. The routing number decides whether the test bank can receive Request for Payment.

Routing numberTest bank
021000021Receives ACH only
271975391Can receive Request for Payment

Outcomes don't depend on the amount or the account number. In the sandbox, an ACH charge succeeds, and a Request for Payment is paid automatically about a minute after you create it. To test a decline, create one of these charges:

  • A charge without network.
  • A charge with network set to "fednow".
  • A charge in a currency other than USD.
  • A Request for Payment to routing number 021000021 without ach_fallback.
  • A Request for Payment with no street in the billing address and without ach_fallback.

Returns can't be simulated in the sandbox.

Next steps

  • Disputes: Track returned debits, which Pay.com records as lost disputes.
  • Refund a charge: Refund a succeeded charge, and review refund statuses.
  • US bank account payouts: Pay out to a customer's US bank account.
  • Webhooks: Configure a webhook endpoint and verify signatures.
Was this page helpful?