cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

eCheck vs ARB integration // Why can't we simply POST key/values for ARB?

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?

charlie1234
Member
1 ACCEPTED SOLUTION

Accepted Solutions
RaynorC1emen7
Expert
2 REPLIES 2
RaynorC1emen7
Expert

I did indeed. It's similar to what I'm already doing (i.e. provides a sample of using curl to transmit the request) but I'm curious why I can't just post the values and have to wrap them in XML first. The only reason I'm asking is because echeck doesn't require an XML-formed request.

 

I think my questions should actually be "can I simply POST key/value pairs for ARB" and the answer is "no".