When you create PaymentMethod using account details received from customer it is not yet ready to be Charged. PaymentMethod would have status "pending".
Verification process of such account can take up to a week.
In Test mode account will be verified and PaymentMethod will became chargeable in a few seconds to simplify testing.
To finish test Payment Method setup one can enter following data.
021000021
4242424242424242
Personal Savings
One can also use above flow with specific account number to trigger various api behaviour
processing_error
insufficient_funds
payment_method_declined
Prior to processing an ACH payment, you must first get permission from the customer by presenting a mandate. This mandate only needs to be displayed the first time you collect the ACH payment details and must be presented as part of the payment flow on your website.
Final language should be reviewed and approved by your legal council review before adding it to your payments checkout page.
Example mandate is present in the example view for reference.
One can also use our Plaid integration to setup ACH account details using Plaid Link and its widget. See our ACH Payment Method with Plaid for more details.
@AjaxController
@RequestMapping("/ajax/examples/ach-payment-method-with-account-details")
public class ExamplesAjaxAchWithAccountDetailsController extends BaseExamplesAjaxAchController {
@PostMapping("/payment-method")
Map createPaymentMethod(@RequestBody ExampleRequest initRequest) throws IOException {
try (Shift4Gateway shift4Gateway = createShift4Gateway()) {
// create payment method
PaymentMethodRequest paymentMethodRequest = new PaymentMethodRequest().set("type", "ach")
.billing(new BillingRequest()
.name(initRequest.billingName))
.set("ach", Map.of(
"account", Map.of(
"accountNumber", initRequest.accountNumber,
"routingNumber", initRequest.routingNumber,
"accountType", initRequest.accountType.name())
)).set("fraudCheckData", Map.of(
"ipAddress", initRequest.ipAddress
));
PaymentMethod paymentMethod = shift4Gateway.createPaymentMethod(paymentMethodRequest);
// pass clientObjectId of payment method to frontend to finish setup there
return singletonMap("clientObjectId", paymentMethod.getClientObjectId());
} catch (Shift4Exception e) {
throw new BadRequestException(e.getMessage());
}
}
static class ExampleRequest {
String billingName;
String routingNumber;
String accountNumber;
AccountType accountType;
String ipAddress;
}
enum AccountType {
personal_checking,
personal_savings,
corporate_checking,
corporate_savings
}
...
}