The final step of the '/process_ach_payment' server-side handler is processing the ACH payment through the ACHQ SpeedChex API
and returning a response to the payment form where your client javascript will indicate success or failure submitting the ACH payment.
The ACHQ SpeedChex API needs the following information to process an ACH payment:
- ACHQ API credentials
- Customer name and address information
- Payment amount and other payment specific information
- Bank account information in one of the following forms:
- An ACHQ processor_token from Plaid
- Traditional bank routing and account number
In the event that your customer chooses not use Plaid to authenticate and provide their bank account information in the form of
a Plaid
processor_token, you can still collect your customer's routing number, bank account number and check type on your
payment form and submit that account data through the ACHQ SpeedChex API.
Production API credentials will be provided to you when you setup your ACHQ merchant account. The ACHQ SpeedChex API supports sandbox, development
and production modes but through a single API endpoint instead of multiple endpoints like Plaid. Please note the following methods for differentiating and
controlling your integration mode for the ACHQ SpeedChex API:
- Sandbox Mode - ACH payments are sent to a Sandbox account where they are captured, stored and show up in status tracking reports and
queries - but they are never sent to the Federal Reserve for processing. You must use the following credentials for sending payments to the Sandbox account
MerchantID: 2001
Merchant_GateID: test
Merchant_GateKey: test
- Development Mode - In Development mode, ACH payments are submitted to the ACHQ API using your production credentials with a TestMode parameter set to "On".
Payments submitted in this mode will receive a valid success or failure response, but unlike Sandbox and Production modes - these ACH payments are never stored
on the ACHQ platform for processing or made available for reporting and status tracking queries.
- Production Mode - ACH payments are submitted to the ACHQ API using your production credentials with TestMode set to "Off" or left undefined.
ACH payments submitted in production mode are batched and submitted through the Federal Reserve for processing each business day.
CLICK HERE to view the full documentation for the ACHQ Speedchex REST API endpoint.
DOWNLOAD our PostMan collection for the ACHQ SpeedChex API's to assist with development and testing.
Submit the payment to ACHQ
function submit_ACHQ_payment(paymentData, processorToken) {
var request = require('request');
request.post({
url: 'https://www.speedchex.com/datalinks/transact.aspx',
headers: {'content-type' : 'application/x-www-form-urlencoded'},
form: { "MerchantID": "2001",
"Merchant_GateID": "test",
"Merchant_GateKey": "test",
"Command": "ECheck.ProcessPayment",
"CommandVersion": "2.0",
"Amount": paymentData.paymentAmount,
"SECCode": "WEB",
"Customer_IPAddress": "127.0.0.1",
"DeliveryWindow": "Standard",
"PaymentDirection": "FromCustomer",
"Merchant_ReferenceID": "12345",
"Description": "Test Transaction",
"Billing_CustomerID": "1234567",
"Billing_CustomerName": paymentData.customername,
"Billing_Address1": paymentData.address1,
"Billing_City": paymentData.city,
"Billing_State": paymentData.state,
"Billing_Zip": paymentData.zip,
"Billing_Phone": paymentData.phone,
"Billing_Email": paymentData.email,
"SendEmailToCustomer": "Yes",
"TokenSource": "Plaid",
"AccountToken": processorToken,
"ResponseType": "JSON"}
},
function(error, response, body){
return body;
});
}
def submit_ACHQ_payment(paymentData, processorToken):
import requests
response = requests.post('https://www.speedchex.com/datalinks/transact.aspx',
data = {
"MerchantID": "2001",
"Merchant_GateID": "test",
"Merchant_GateKey": "test",
"Command": "ECheck.ProcessPayment",
"CommandVersion": "2.0",
"Amount": paymentData.paymentAmount,
"SECCode": "WEB",
"Customer_IPAddress": "127.0.0.1",
"DeliveryWindow": "Standard",
"PaymentDirection": "FromCustomer",
"Merchant_ReferenceID": "12345",
"Description": "Test Transaction",
"Billing_CustomerID": "1234567",
"Billing_CustomerName": paymentData.customername,
"Billing_Address1": paymentData.address1,
"Billing_City": paymentData.city,
"Billing_State": paymentData.state,
"Billing_Zip": paymentData.zip,
"Billing_Phone": paymentData.phone,
"Billing_Email": paymentData.email,
"SendEmailToCustomer": "Yes",
"TokenSource": "Plaid",
"AccountToken": processorToken,
"ResponseType": "JSON"
})
return response.text
}
require 'net/http'
def submit_ACHQ_payment (paymentData, processorToken)
uri = URI('https =>//www.speedchex.com/datalinks/transact.aspx')
request = Net::HTTP::Post.new(uri)
request.set_form_data('MerchantID' => '2001',
'GateID' => 'test',
'Merchant_GateKey' => 'test',
'Command' => 'ECheck.ProcessPayment',
'CommandVersion' => '2.0',
'Amount' => paymentData['paymentAmount'],
'SECCode' => 'WEB',
'Customer_IPAddress' => '127.0.0.1',
'DeliveryWindow' => 'Standard',
'PaymentDirection' => 'FromCustomer',
'Merchant_ReferenceID' => '12345',
'Description' => 'Test Transaction',
'Billing_CustomerID' => '1234567',
'Billing_CustomerName' => paymentData['customername'],
'Billing_Address1' => paymentData['address1'],
'Billing_City' => paymentData['city'],
'Billing_State' => paymentData['state'],
'Billing_Zip' => paymentData['zip'],
'Billing_Phone' => paymentData['phone'],
'Billing_Email' => paymentData['email'],
'SendEmailToCustomer' => 'Yes',
'TokenSource' => 'Plaid',
'AccountToken' => processorToken,
'ResponseType' => 'JSON')
response = http.request(request)
return response.body
end
static void submitACHQPayment(JSONObject paymentData, String processorToken) string {
// Set the URL to the ACHQ rest API endpoint
String postEndpoint = "https://www.speedchex.com/datalinks/transact.aspx";
// Build the ECheck.ProcessPayment parameters
String requestBody = "MerchantID=2001"
+ "&Merchant_GateID=test"
+ "&Merchant_GateKey=test"
+ "&Command=ECheck.ProcessPayment"
+ "&CommandVersion=2.0"
+ "&Amount=" + paymentData.get("paymentAmount")
+ "&SECCode=WEB"
+ "&Customer_IPAddress=" + "127.0.0.1"
+ "&DeliveryWindow=Standard"
+ "&PaymentDirection=FromCustomer"
+ "&Merchant_ReferenceID=" + "12345"
+ "&Description=" + "Test Transaction"
+ "&Billing_CustomerID=" + "1234567"
+ "&Billing_CustomerName=" + paymentData.get("customername")
+ "&Billing_Address1=" + paymentData.get("address1")
+ "&Billing_City=" + paymentData.get("city")
+ "&Billing_State=" + paymentData.get("state")
+ "&Billing_Zip=" + paymentData.get("zip")
+ "&Billing_Phone=" + paymentData.get("phone")
+ "&Billing_Email=" + paymentData.get("email")
+ "&SendEmailToCustomer=Yes"
+ "&TokenSource=Plaid"
+ "&AccountToken=" + processorToken
+ "&ResponseType=JSON";
var request = HttpRequest.newBuilder()
.uri(URI.create(postEndpoint))
.POST(HttpRequest.BodyPublishers.ofString(requestBody))
.build();
// Submit the API call to Plaid
var client = HttpClient.newHttpClient();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
// return the json response string
return response.body();
}
func submit_ACHQ_payment(paymentData, processorToken) string {
// Set the URL to the ACHQ rest API endpoint
link := "https://www.speedchex.com/datalinks/transact.aspx"
// Build the ECheck.ProcessPayment parameters as a JSON object
reqBody, err := json.Marshal(gin.H{
"MerchantID": "2001",
"Merchant_GateID": "test",
"Merchant_GateKey": "test",
"Command": "ECheck.ProcessPayment",
"CommandVersion": "2.0",
"Amount": paymentData["paymentAmount"],
"SECCode": "WEB",
"Customer_IPAddress": "127.0.0.1",
"DeliveryWindow": "Standard",
"PaymentDirection": "FromCustomer",
"Merchant_ReferenceID": "12345",
"Description": "Test Transaction",
"Billing_CustomerID": "1234567",
"Billing_CustomerName": paymentData["customername"],
"Billing_Address1": paymentData["address1"],
"Billing_City": paymentData["city"],
"Billing_State": paymentData["state"],
"Billing_Zip": paymentData["zip"],
"Billing_Phone": paymentData["phone"],
"Billing_Email": paymentData["email"],
"SendEmailToCustomer": "Yes",
"TokenSource": "Plaid",
"AccountToken": processorToken,
"ResponseType": "JSON"
})
if err != nil {
return '{"error": err.Error()}'
}
// Submit the API call to Plaid
plaid_response, err := client.Post(link, "application/json; charset=utf-8", bytes.NewBuffer(reqBody))
if err != nil {
return '{"error": err.Error()}'
}
defer response.Body.Close()
// Parse for the ACHQ payment response
plaid_responseBytes, _ := ioutil.ReadAll(plaid_response.Body)
// return the json response string
return strings.TrimSpace(string(plaid_responseBytes))
}
// Data fields broken out to multiple lines for reading clarity only
curl -X POST https://www.speedchex.com/datalinks/transact.aspx
-d 'MerchantID=2001
&Merchant_GateID=test
&Merchant_GateKey=test
&Command=ECheck.ProcessPayment
&CommandVersion=2.0
&Provider_TransactionID=12345
&CheckNumber=1234
&CheckType=Business
&AccountType=Checking
&RoutingNumber=123123123
&AccountNumber=987654321
&Amount=50.00
&SECCode=WEB
&Customer_IPAddress=127.0.0.1
&DeliveryWindow=Standard
&PaymentDirection=FromCustomer
&Merchant_ReferenceID=12345
&Description=Test Transaction
&Billing_CustomerID=1234567
&Billing_CustomerName=Joe Buyer
&Billing_Company=Some Company Inc.
&Billing_Address1=1234 Purchaser Lane
&Billing_Address2=Suite 500
&Billing_City=New York
&Billing_State=NY
&Billing_Zip=12345
&Billing_Phone=(555) 222-1234
[email protected]
&SendEmailToCustomer=Yes
&ResponseType=JSON'