Reply
Highlighted
New Member
Posts: 2
Registered: ‎09-13-2020

returns NULL even though the transaction has been created successfully

[ Edited ]

Hi,

I'm integrating Authorize.Net SDK.

But If I requested a real payment transaction, it returns NULL even though the transaction has been created successfully.

 

So I tested a simple request like below.

The following code works and returned "Message Code: I00001 Text: Successful."

 

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName('idxxxxxxxx');
$merchantAuthentication->setTransactionKey('xxxxxxxxxxxxxxxx');

$refId = 'ref' . time();

$request = new AnetAPI\AuthenticateTestRequest();
$request->setMerchantAuthentication($merchantAuthentication);
$request->setRefId($refId);

$controller = new AnetController\AuthenticateTestController($request);
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION); 

if ($response != null) {
  if ($response->getMessages()->getResultCode() == "Ok") {
    $message = $response->getMessages()->getMessage();
    echo " Message Code: " . $message[0]->getCode();
    echo " Text: " . $message[0]->getText();
  } else {
    echo "Authetication Failed";
  }
  print_r($response);
} else {
  echo "No response returned";
}

 

 

And if I tried the sample code in the API reference, it retunred NULL too.

https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card

 

Please advice.

Thank you!

 

 

Highlighted
New Member
Posts: 2
Registered: ‎09-13-2020

Re: returns NULL even though the transaction has been created successfully

Here is the log of the call. "Response from AnetApi" is null.

 

Sun, 13 Sep 2020 00:01:32 -0700 INFO : [_sendRequest] (/app/vendor/AuthorizeNet/lib/net/authorize/util/HttpClient.php : 96) - Response from AnetApi:
Sun, 13 Sep 2020 00:01:32 -0700 ERROR : [execute] (/app/vendor/AuthorizeNet/lib/net/authorize/api/controller/base/ApiOperationBase.php : 146) - Error getting response from API