cancel
Showing results for 
Search instead for 
Did you mean: 

Who Me Too'd this topic

Error - Refund Transaction

Good afternoon.

 

I use the Authorize.net api correctly to debit credit cards. But when I try to make a refund to a transaction the system to any transaction id it generates error 54 - The referenced transaction does not meet the criteria for issuing a credit.

 

I do not know what this error can be. Please, I need your help to solve this problem. Annex code in php used. Thank you.

 

      

 $merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
        $merchantAuthentication->setName($AuthUser);
        $merchantAuthentication->setTransactionKey($AuthPass);

        $refId = 'ref' . time();

        $creditCard = new AnetAPI\CreditCardType();
        $creditCard->setCardNumber($card);
        $creditCard->setExpirationDate($exp);        

        $paymentOne = new AnetAPI\PaymentType();
        $paymentOne->setCreditCard($creditCard);

        $transactionRequest = new AnetAPI\TransactionRequestType();
        $transactionRequest->setTransactionType("refundTransaction");
        $transactionRequest->setAmount($mont);
        $transactionRequest->setRefTransId($codTrans);
        $transactionRequest->setPayment($paymentOne);

        $request = new AnetAPI\CreateTransactionRequest();
        $request->setMerchantAuthentication($merchantAuthentication);
        $request->setRefId($refId);
        $request->setTransactionRequest($transactionRequest);

        $controller = new AnetController\CreateTransactionController($request);
        $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX);
SysFreak
Member
Who Me Too'd this topic