cancel
Showing results for 
Search instead for 
Did you mean: 

Charge declined, but $response->error_message returns false

I'm running my own PHP script to process transactions. The relevant section looks like this:

 

$fields = array(
  'first_name' => $cardholder_first,
  'last_name' => $cardholder_last,
  'company' => $company,
  'address' => $street1,
  'city' => $city,
  'state' => $state,
  'zip' => $zip,
  'country' => "US",

  'phone' => $tele,
  'email' => $email,

  'description' => "Advertisement on $site",
  'amount' => $value,

  'card_num' => $ccn_dec,
  'exp_date' => sprintf('%02d%02d', $expire_month, ($expire_year % 1000)),
  'card_code' => $cvc2
);

 

$transaction->setFields($fields);
$response = $transaction->authorizeOnly();

 

if ($response->approved) $this_response = $response->transaction_id;
else $this_response = $response->error_message;

 

// for testing

echo $this_response;

 

 

If the transaction is approved, I'm getting a transaction ID as expected, But I had one to decline today, and it just returned empty; either "false" or "", I'm not sure which.

 

When I logged in to Auth.net, it listed the following errors:

 

Declined  (Card declined by issuer - Contact card issuer to determine reason.)

Address Verification Status: No match on Street and Zip (N)

 

 

The question now is, why didn't $this_response equal one of those two errors? I'm pretty sure that this USED to work, but now I'm questioning whether it's always had a problem, and I've just now discovered it. If so, then I'm sure I've had a lot of customers that were declined but didn't get the error message, so they just thought that I had ignored them.

 

TIA.

jwcarlton
Contributor
1 REPLY 1

anet_php_sdk-1.1.8.zip\anet_php_sdk\lib\AuthorizeNetAIM.php

doesn't look like error_message is set for decline

RaynorC1emen7
Expert