cancel
Showing results for 
Search instead for 
Did you mean: 

Undefined Property - PHP error

I'm getting a php error...

 

Sandbox mode worked fine and the SDK is in place. I switched my account to live mode, updated/recopied the API Login ID and Transaction Key (in case they changed by going live), and added the $transaction-setSandbox(false); code. 

 

I now get the following PHP error:

 

Notice: Undefined property: AuthorizeNetAIM_Response::$error_message 

 

If I take out the setSandbox(false) line, the PHP error goes away and the normal authorize.net error 13 code shows (which makes sense as the sandbox code is trying to connect to a live account).

 

Any help would be greatly appreciated.

 

 

 

require_once 'anet_php_sdk/AuthorizeNet.php';
$transaction = new AuthorizeNetAIM('XXXXX, 'XXXXX');    // this is the line the error occurs

$transaction->setSandbox(false);
$transaction->amount = $amount;
$transaction->card_num = $number;
$transaction->exp_date = $expiration;
$transaction->first_name = $first;
$transaction->last_name = $last;

 

$response = $transaction->authorizeAndCapture();

 

if ($response->approved)
{

// some code

}

 

else
{

echo $response->error_message;

}

 

TimTysons
Member
1 REPLY 1

What displays if you do a print_r($response)?

TJPride
Expert