> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anglpay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Repay - Bank account (ACH)

> Process ACH payments from bank accounts stored in the platform through Repay.

**Repay**

Repay is a payments technology company. The platform integrates with Repay's Payrazr
gateway to debit a buyer's US bank account over ACH, using the account number
and routing number instead of card details.

Payrazr only offers ACH sales, so there is no separate authorization step. A
transaction is captured as soon as Repay accepts it, and Repay submits it to the
ACH network when it closes its nightly batch.

## Setup

Repay doesn't offer self-service sign-up. Speak to your Repay account manager
to request sandbox credentials for the Payrazr gateway, and ask them to enable
the following on the ZID you want to use:

* **ACH processing** - ACH is a separate Payrazr product from card processing,
  so a ZID that already takes cards doesn't automatically accept bank payments.
* **ACH refunds** - Refunds are a separate entitlement from ACH processing.
  Without it, Repay rejects every refund on the ZID.

## Connector configuration

Bank payments are routed directly rather than through Flow. When you create a
transaction, set the `payment_service_id` parameter to the ID of your Repay
bank connection.

The connector ID can be found in the dashboard under **Connections** ->
**Configured connections**.

## Credentials

Configure the following credentials in the dashboard, which are
provided by your Repay account manager. They're the same fields used by the
[Repay card connector](https://docs.anglpay.com/connections/payments/repay-card.md).

* **API Username** - Your Payrazr API username
* **API Password** - Your Payrazr API password
* **ZID** - Your Payrazr merchant location identifier, with ACH enabled

## Capabilities

This list is for guidance only. It doesn't guarantee availability or
create any rights, and the provider may need to enable some features for
your account.

## Supported countries

**Bank account (ACH)**

## Supported currencies

**Bank account (ACH)**

## Integration

The connection requires the following fields in the transaction request.

* `payment_method.account_number` - The buyer's bank account number.
* `payment_method.routing_number` - The buyer's 9-digit ABA routing number.
* `payment_method.account_type` - Either `checking` or `savings`. If you omit
  it, the platform sends the account to Repay as a checking account.
* `payment_method.account_holder` - The account holder's name. Send
  `company_name` for a business account, or `first_name` and `last_name` for a
  personal one.
* `buyer.billing_details.first_name` and `buyer.billing_details.last_name`
* `buyer.billing_details.address.state_code` - The state the account holder is
  in, in ISO 3166-2 format, for example `US-NY`. Repay requires a state on every
  ACH transaction. Without it, the transaction fails with a
  `missing_billing_address` error.

Sending the rest of `buyer.billing_details.address` and the buyer's email address
is recommended, as the platform forwards them to Repay with the transaction.

The following samples also set `payment_service_id`, as described under
[Connector configuration](#connector-configuration).

```csharp C# theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
var transaction = await client.Transactions.CreateAsync(
  transactionCreate: new TransactionCreate()
  {
    Amount = 1299,
    Currency = "USD",
    Country = "US",
    Intent = "capture",
    PaymentMethod = TransactionCreatePaymentMethod.CreateACHBankPaymentMethodCreate(
      new ACHBankPaymentMethodCreate()
      {
        AccountNumber = "1020304050",
        RoutingNumber = "021000322",
        AccountType = AccountType.Checking,
        AccountHolder = new BankAccountHolder()
        {
          FirstName = "John",
          LastName = "Doe"
        }
      }
    ),
    Buyer = new GuestBuyer()
    {
      BillingDetails = new BillingDetails()
      {
        FirstName = "John",
        LastName = "Doe",
        Address = new Address()
        {
          StateCode = "US-NY"
        }
      }
    },
    PaymentServiceId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  }
);
```

```go Go theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
amount := int64(1299)
currency := "USD"
country := "US"
firstName := "John"
lastName := "Doe"
stateCode := "US-NY"
paymentServiceId := "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

achPaymentMethod := components.ACHBankPaymentMethodCreate{
  AccountNumber: "1020304050",
  RoutingNumber: "021000322",
  AccountType:   components.AccountTypeChecking.ToPointer(),
  AccountHolder: components.BankAccountHolder{
    FirstName: &firstName,
    LastName:  &lastName,
  },
}
paymentMethod := components.CreateTransactionCreatePaymentMethodACHBankPaymentMethodCreate(achPaymentMethod)

transactionCreate := components.TransactionCreate{
  Amount:        amount,
  Currency:      currency,
  Country:       &country,
  Intent:        components.TransactionIntentCapture.ToPointer(),
  PaymentMethod: &paymentMethod,
  Buyer: &components.GuestBuyer{
    BillingDetails: &components.BillingDetails{
      FirstName: &firstName,
      LastName:  &lastName,
      Address: &components.Address{
        StateCode: &stateCode,
      },
    },
  },
  PaymentServiceID: &paymentServiceId,
}

transaction, err := client.Transactions.Create(ctx, transactionCreate, nil, nil, nil)
```

```java Java theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
CreateTransactionResponse transactionResponse = gr4vyClient.transactions().create()
  .transactionCreate(TransactionCreate.builder()
    .amount(1299L)
    .currency("USD")
    .country("US")
    .intent(TransactionIntent.CAPTURE)
    .paymentMethod(TransactionCreatePaymentMethod.of(ACHBankPaymentMethodCreate.builder()
      .accountNumber("1020304050")
      .routingNumber("021000322")
      .accountType(AccountType.CHECKING)
      .accountHolder(BankAccountHolder.builder()
        .firstName("John")
        .lastName("Doe")
        .build())
      .build()))
    .buyer(GuestBuyer.builder()
      .billingDetails(BillingDetails.builder()
        .firstName("John")
        .lastName("Doe")
        .address(Address.builder()
          .stateCode("US-NY")
          .build())
        .build())
      .build())
    .paymentServiceId("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
    .build())
  .call();

Transaction transaction = transactionResponse.transaction().orElse(null);
```

```php PHP theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
$transactionCreate = new TransactionCreate(
  amount: 1299,
  currency: 'USD',
  country: 'US',
  intent: 'capture',
  paymentMethod: new ACHBankPaymentMethodCreate(
    method: 'bank',
    scheme: 'ach',
    accountNumber: '1020304050',
    routingNumber: '021000322',
    accountType: 'checking',
    accountHolder: new BankAccountHolder(
      firstName: 'John',
      lastName: 'Doe'
    )
  ),
  buyer: new GuestBuyer(
    billingDetails: new BillingDetails(
      firstName: 'John',
      lastName: 'Doe',
      address: new Address(
        stateCode: 'US-NY'
      )
    )
  ),
  paymentServiceId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
);
$response = $sdk->transactions->create($transactionCreate);
$transaction = $response->transaction;
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
transaction = client.transactions.create(
  amount=1299,
  currency="USD",
  country="US",
  intent="capture",
  payment_method={
    "method": "bank",
    "scheme": "ach",
    "account_number": "1020304050",
    "routing_number": "021000322",
    "account_type": "checking",
    "account_holder": {
      "first_name": "John",
      "last_name": "Doe"
    }
  },
  buyer={
    "billing_details": {
      "first_name": "John",
      "last_name": "Doe",
      "address": {
        "state_code": "US-NY"
      }
    }
  },
  payment_service_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
)
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const transaction = await client.transactions.create({
  amount: 1299,
  currency: "USD",
  country: "US",
  intent: "capture",
  paymentMethod: {
    method: "bank",
    scheme: "ach",
    accountNumber: "1020304050",
    routingNumber: "021000322",
    accountType: "checking",
    accountHolder: {
      firstName: "John",
      lastName: "Doe"
    }
  },
  buyer: {
    billingDetails: {
      firstName: "John",
      lastName: "Doe",
      address: {
        stateCode: "US-NY"
      }
    }
  },
  paymentServiceId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
});
```

An approved transaction comes back as captured, with no buyer approval step. For the field
reference, vaulting, and recurring payment flows shared by every bank connector, see
[Bank accounts](https://docs.anglpay.com/connections/payments/bank.md).

### Account types

The platform maps the account type and account holder to one of Repay's account types.

| `account_type` | `account_holder` | Sent to Repay as |
| - | - | - |
| `checking` | `company_name` set | Business checking |
| `checking` | `first_name` and `last_name` | Personal checking |
| `savings` | Any | Personal savings |

Repay has no business savings account type, so a business savings account is
sent as personal savings.

### SEC codes

Every ACH debit carries a Standard Entry Class (SEC) code that describes
how the account holder authorized it. Repay checks the code against the account
type and rejects a mismatch, so the platform picks the code as follows.

| Condition | SEC code |
| - | - |
| Business checking account | `CcdDebit` |
| `connection_options.repay-bank.sec_code` set | That value |
| `payment_source` is `moto`, for a debit entered by an agent | `TelDebit` |
| Any other transaction, for a debit entered by the buyer online | `WebDebit` |

If you collected a written or verbal authorization rather than one through
your website, set the code yourself with the `sec_code` connection option. It
accepts `WebDebit`, `TelDebit`, or `PpdDebit`, and is ignored on business
accounts, which Repay requires to use `CcdDebit`.

```json theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
{
  "connection_options": {
    "repay-bank": {
      "sec_code": "PpdDebit"
    }
  }
}
```

### Recurring payments

Repay doesn't distinguish the first customer-initiated transaction in a recurring
series from later merchant-initiated ones. The platform flags the whole series as
recurring using a single indicator.

Repay requires the account holder's state on every debit, including
merchant-initiated ones. Store the bank account against a buyer with a billing
address, or send `buyer.billing_details` on each transaction. Otherwise, a
payment with a stored bank account fails with a `missing_billing_address` error.

### Refunds

Full and partial refunds are supported, and a transaction can be refunded in
several parts up to its original amount. Refunds require the ACH refunds
entitlement described under [Setup](#setup).

## Limitations

The following features are not supported by this connector:

* **Delayed capture** - Authorization and capture always happen together
* **Void** - Cannot cancel a transaction once it is submitted. Use a refund
  instead
* **Returns** - ACH returns arrive days after a transaction is captured, and
  Repay sends no webhooks and has no way to look up an ACH transaction's status.
  A returned transaction stays captured in the platform, so reconcile returns from your
  Repay reports.
* **Transaction sync** - Transaction synchronization is not supported
* **Duplicate protection** - The platform tells Repay to accept repeated transactions
  for the same amount, so retrying a request can debit the account twice
* **Payment method tokenization** - Bank accounts are stored by the platform, not by
  Repay

## Testing

Repay's sandbox validates the routing number and the account number. Use one
of the following test accounts.

| Routing number | Account number |
| - | - |
| `061000227` | `0102030405` |
| `021000322` | `1020304050` |
| `322271627` | `12131415` |

The sandbox approves any correctly formatted ACH transaction, whatever the
amount. To test a decline, send a routing number that isn't valid, such as
`123456789`. Repay declines it with `AccountValidationFailed`, and the platform
returns an `incorrect_number` error.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.