cancel
Showing results for 
Search instead for 
Did you mean: 

Please help . cannot connect to transaction api

Hi, authorize develop team
 
I need some help here
function had been enable in the back end.
I download anet_php_sdk for php langauge. I setup api login id and transaction key to generate transaction file but it seems not working. Please help.
 
<?php
require_once 'anet_php_sdk/AuthorizeNet.php';
define("AUTHORIZENET_API_LOGIN_ID", "XXXXXXX");
define("AUTHORIZENET_TRANSACTION_KEY", "XXXXXXX");
 

$request = new AuthorizeNetTD;
$response = $request->getSettledBatchList();
$batches = $response->xpath("batchList/batch");
echo "Batch 1: {$batches[0]->batchId}";    ---> line 10
 
// Get Settled Batch List
$request = new AuthorizeNetTD;
$response = $request->getSettledBatchList();
echo count($response->xml->batchList->batch) . " batches\n";
foreach ($response->xml->batchList->batch as $batch) {   ---> line 16
    echo "Batch ID: " . $batch->batchId . "\n";
}
 
// Get Transaction Details
$transactionId = "3866734968";
$response = $request->getTransactionDetails($transactionId);
echo $response->xml->transaction->transactionStatus;
echo $transactionId;
 
?>
 
Here is error msg I got
Notice: Undefined offset: 0 in C:\xampp\htdocs\athorize_detail.php on line 10

Notice: Trying to get property of non-object in C:\xampp\htdocs\athorize_detail.php on line 10
Batch 1: 0 batches
Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\athorize_detail.php on line 16
AAAAAAAA
 
$transactionId = "AAAAAAAA";
and this transaction id I found it 2011-09-19 11:36:08 it’s a real transaction
 
Please help why I cannot generate XML , thank you

momouhsu
Member
3 REPLIES 3

Well, $batches is obviously not having anything assigned to it, so my guess would be that there's either no response (unlikely, I hope) or you're accessing the batches incorrectly. I can't give a more specific answer because I haven't worked with batches yet, but if I were debugging this I'd do print_r($response) and make sure that (a) it has data in it and (b) has the method or attribute that you're trying to put into $batches. That will at least narrow the possibilities.

TJPride
Expert

I got this message .. I used same ID and key to accept payment with no error ... I don't knwo why here show User authentication failed due to invalid authentication values.

 

AuthorizeNetTD_Response Object ( [xml] => SimpleXMLElement Object ( [messages] => SimpleXMLElement Object ( [resultCode] => Error [message] => SimpleXMLElement Object ( [code] => E00007 [text] => User authentication failed due to invalid authentication values. ) ) ) [response] => ErrorE00007User authentication failed due to invalid authentication values. [xpath_xml] => SimpleXMLElement Object ( [messages] => SimpleXMLElement Object ( [resultCode] => Error [message] => SimpleXMLElement Object ( [code] => E00007 [text] => User authentication failed due to invalid authentication values. ) ) ) )

momouhsu
Member

Have you printed out your login values to make sure they're actually making it where they're supposed to go? Also, are you in the correct sandbox or non-sandbox mode for that login?