cancel
Showing results for 
Search instead for 
Did you mean: 

Problems using Void Transaction with AIM

I seem to be having some issues with using the void transaction method.  It does not seem to be working while in test mode (gives me error 13) and it is also returning the response as html rather than delimited data.  Here is what I am using in the code:

 

 

$data = array(
   "x_login"            => $auth_login,
   "x_tran_key"         => $auth_key,
   
   "x_version"          => "3.1",
   "x_delim_data"       => "TRUE",
   "x_delim_char"       => "|",
   "x_relay_response"   => "FALSE",
   
   "x_type"             => "VOID",
   "x_trans_id"         => $response_array[6],
   "x_test_request"     => TRUE
);

$request = curl_init($post_url);
   curl_setopt($request, CURLOPT_HEADER, 0);
   curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt($request, CURLOPT_POSTFIELDS, $data);
   curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE);
   $post_response = curl_exec($request);
curl_close ($request);

 

What can I do to get this to stop giving me the error 13 and to also return the data like my other requests with a delimeter?

 

Thanks,

David

sterling
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Ok it looks like I have found my solution. 

 

RaynorC1emen7 said the following:

 

From http://www.php.net/manual/en/function.curl-setopt.php

 Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.

 

 

It looks like I simply left out the part to url encode the data and was sending it as a plain array :smileyembarrassed:

View solution in original post

3 REPLIES 3

Echo the $request.

 

And make sure if you are using test account the url should be test.authorize.net

and Production account to secure.authorize.net

 

RaynorC1emen7
Expert

Got moved around on projects for awhile...now I'm back onto this.  Sorry for the huge gap in replies.

Here is what I get in return from the request: Resource id #2

 

 

The actual response I get back is this:

<HTML><BODY><H3>The following errors have occurred.</H3>(13) The merchant login ID or password is invalid or the account is inactive.<BR></BODY></HTML>

I am using the following url: https://test.authorize.net/gateway/transact.dll

And I am indeed using my test account.

 

 

So I still have two problems...One is that I cannot seem to properly void a transaction and the other is that authorize.net is returning html as a response instead of an array format. 

 

I was hoping to be able to get authorize.net to return  delimited result from any request I make.  Is this not possible?

Ok it looks like I have found my solution. 

 

RaynorC1emen7 said the following:

 

From http://www.php.net/manual/en/function.curl-setopt.php

 Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.

 

 

It looks like I simply left out the part to url encode the data and was sending it as a plain array :smileyembarrassed: