cancel
Showing results for 
Search instead for 
Did you mean: 

Another Credit processing question (AIM)

I've been going round and round trying to figure out why my credits won't process properly. I keep getting an incorrect card number message despite what I use. I know I have the right number and I've submitted it as both 'XXXX0000' as well as '0000'. I tried both ways because I've found conflicting information on this forum. I wish I had a good PHP example to follow since there might be something I'm missing. I'm not sure why the downloadable sample only has VOID as a refund example and not a more inclusive refund and partial refund example.

 

Here's the first part of my code:

 

if ($METHOD_TO_USE == "AIM") {

   $transaction = new AuthorizeNetAIM;    

   $transaction->setSandbox(AUTHORIZENET_SANDBOX);    

   $transaction->setFields(        

      array(        

       'trans_id'=> $confcode,         

       'amount'=> $refund,                 

       'card_num'=> $ccnum,  //currently set for last 4 digits only      

       'type' => "CREDIT",          

      )    

);    

$response = $transaction->authorizeAndCapture();    

if ($response->approved) {...

 

Is that the correct way to start the refund process? Any idea why I might be getting the card number error?

 

Thank you in advance,

Don

chefgoot
Member
2 REPLIES 2

Shouldn't it be

$response = $transaction->credit();

 


RaynorC1emen7
Expert

Thank you, that was it. I appreciate the help.

 

It would have been great to have that in a sample php with the sample application.