I just implemented eCheck in a form where we capture the appropriate data points from the customer and then POST them to Authnet. This is super, super simple and requires no third party libraries (such as an Authnet sample SDK). Consider this pseudo code where we just use curl to perform the request:
function process_echeck($routing_number, $account_number, $bank_name, $account_type, $customer_name, $check_number, $amount) {
$params = array(
'x_login' => AUTHNET_API_LOGIN,
'x_tran_key' => AUTHNET_TRAN_KEY,
'x_method' => 'ECHECK',
'x_amount' => $amount,
'x_bank_aba_code' => $routing_number,
'x_bank_acct_num' => $account_number,
'x_bank_acct_type' => $account_type,
'x_bank_name' => $bank_name,
'x_bank_acct_name' => $customer_name,
'x_echeck_type' => 'WEB',
'x_bank_check_number' => $check_number,
'x_relay_response' => 'false',
'x_delim_data' => 'true',
'x_response_format' => 1,
);
$params_string = '';
foreach($params as $key=>$value) {
$params_string .= $key.'='.$value.'&';
}
rtrim($params_string, '&');
$ch = curl_init(AUTHNET_URL_TRANSACT);
curl_setopt($ch, CURLOPT_URL, AUTHNET_URL_TRANSACT);
curl_setopt($ch, CURLOPT_POST, count($params));
curl_setopt($ch, CURLOPT_POSTFIELDS, $params_string);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);
$response = explode(',', $response);
// Deal with response, error out, save to a database, email customer receipt, etc.
}
Now I'm moving along to adding automated recurring billing to this, so that a user can say "make this same payment once a month for the next 6 months". I've got the documentation up for ARB, and am surprised to find that my only options are submitting an XML request or an XML/SOAP request. Why is there no direct POST method for ARB?