Accept an ACH Payment
Accept an ACH payment (a bank-account payment through the Automated Clearing House network) in your Android integration by collecting bank account details and submitting the payment with the Stax SDK.
This guide is for Android developers. Tokenization replaces bank account details with a reusable payment-method token so you can reference the account without passing its details again.
Prepare your Android integration
- Install and initialize the SDK using the Android SDK guide so your app can submit payment requests.
- Start with
BankAccount.testBankAccount()and the SDK’spaymethod to test a direct payment without entering real bank account details. Use this SDK-only path for your first integration; you do not need a separate tokenization request or an API charge request. - Test the error callback with
BankAccount.failingTestBankAccount()before collecting real bank account details.
The Kotlin snippets below illustrate individual SDK calls, not a complete runnable payment integration. They require the SDK setup above; the payment submission steps describe the required flow without providing a complete implementation.
1. Create a bank account object
Create a BankAccount object (the SDK object that holds bank account details). For your first test payment, use BankAccount.testBankAccount() as shown in the testing section below.
When you need to enter test details manually, use the following Kotlin fragment within your initialized Android SDK integration. Collect bank account information—not credit card information—when replacing test data with customer-provided details.
val bankAccount = BankAccount(
personName = "Jim Parsnip",
bankType = "savings",
bankAccount = "9876543210",
bankRouting = "021000021",
addressZip = "32822"
)Expected result: bankAccount contains the test account details. Creating this object does not submit a payment.
2. Submit a payment
Create a TransactionRequest (the SDK object describing the payment) with an Amount of 3 cents and the bankAccount object, then pass the request to Omni’s pay method.
Handle both callbacks:
- Success: Use the returned completed transaction to display the payment result.
- Error: Display the returned error and do not report the payment as successful.
3. Verify the payment result
Confirm that the success callback returns a completed transaction before displaying a successful payment result. If the error callback runs instead, treat the attempt as unsuccessful and surface the error to the user.
Optional: Tokenize a bank account for an API payment
To obtain a reusable payment method, pass the BankAccount object to Omni’s tokenize method. Handle the returned payment method in the success callback and the returned error in the error callback.
Tokenization creates a payment method; it does not charge the account. After tokenization succeeds, pass the ID from the returned payment method as the required payment_method_id field when calling POST /charge on the Stax API.
Use the ID returned by this tokenization request. This flow does not require you to copy an ID from the Dashboard or enter a dummy Stax ID. When you implement the API request, add a code comment identifying the tokenization result as the source of payment_method_id.
If tokenization fails, do not submit a charge: no successful payment method has been returned for that attempt. A successful tokenization result is a payment method containing the ID you can use for the API payment.
Optional: Test successful and failed bank accounts
Use BankAccount.testBankAccount() to create a test account for the successful path:
val bankAccount = BankAccount.testBankAccount()Expected result: the SDK returns a test BankAccount object. Use that object in your payment or tokenization request; creating it does not submit a request.
Use BankAccount.failingTestBankAccount() to create a test account for the failure path:
val failingBankAccount = BankAccount.failingTestBankAccount()Expected result: the SDK returns a test BankAccount object intended to exercise failure handling when you submit the request. Verify that your integration reports the error rather than displaying a successful payment result.
Enter test bank account details manually
Use these documented banking test values when constructing a BankAccount yourself:
| Field | Test value |
|---|---|
| Routing number | 021000021 |
| Account number | 9876543210 |
To test a failing account, use the same routing number with a different account number. These are bank routing and account numbers, not Stax object IDs; keep them in their documented numeric-string format.
Updated 4 days ago
