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);
09-13-2017 10:19 AM
Hello @SysFreak
One reason for this error if the transaction you want to refund has not settled, in this case you'll need to void instead.
You can also use our lookup tool to get more information: https://developer.authorize.net/api/reference/responseCodes.html?code=54
09-13-2017 11:18 AM
Code: 54 = The referenced transaction does not meet the criteria for issuing a credit. It may be unsettled, an invalid type, the wrong currency, an invalid reference transaction ID or settled more than 120 days ago.
Consider applying for Expanded Credit-Return Capabilities if you need to refund transactions older than 120 days.
09-13-2017 11:49 AM
Hello, I'm having the same problem and it's not related to:
Refunding works in the auth.net portal. Charging and all other API calls that we use work as prescribed but refund does not. Below is the JSON for the refund transaction. This transaction was charged via the API.
If anyone has a solution or recommendations, please let me know. The OP did not say how/if their issue was resolved.
Thanks!
-- refundTransactionJsonRequest:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "__NAME__",
"transactionKey": "__KEY__"
},
"refId": "1515256688.3892",
"transactionRequest": {
"transactionType": "refundTransaction",
"amount": "79.80",
"payment": {
"creditCard": {
"cardNumber": "CCCC",
"expirationDate": "XXXX"
}
},
"refTransId": "__ORIGINAL_TRANSID__",
"order": {
"invoiceNumber": "20180101-003943-8D",
"description": "Refund for erroneous charges. We apologize for any inconvenience. Thank You!"
},
"transactionSettings": {
"setting": [
{
"settingName": "emailCustomer",
"settingValue": 1
}
]
}
}
}
}
-- refundTransactionJsonResponse:
{
"transactionResponse": {
"responseCode": "3",
"authCode": "",
"avsResultCode": "P",
"cvvResultCode": "",
"cavvResultCode": "",
"transId": "0",
"refTransID": "__ORIGINAL_TRANSID__",
"transHash": "__TRANSHASH__",
"testRequest": "0",
"accountNumber": "",
"accountType": "",
"errors": [
{
"errorCode": "54",
"errorText": "The referenced transaction does not meet the criteria for issuing a credit."
}
],
"shipTo": [],
"transHashSha2": ""
},
"refId": "1515256688.3892",
"messages": {
"resultCode": "Error",
"message": [
{
"code": "E00027",
"text": "The transaction was unsuccessful."
}
]
}
}
01-06-2018 09:11 AM - edited 01-06-2018 09:17 AM
Hi bguilbert,
I recently tried it using apitest endpoint and it worked for me. Below are some points that you can double check in your request:
When issuing a credit card refund, the request must include:
1. either a full card number and expiration date, or
2. the original transaction ID (transID) and last 4 digits of the card number.
If you don't have the last 4 digits of credit card, you can use getTransactionDetails API to retrieve the payment information needed to issue a refund.
Hope this helps!!
01-06-2018 11:22 AM
Thanks for your reply. I've read what info is available on this and do have all the correct info in the request per the spec ... that's what's driving me nuts! ;)
01-06-2018 05:34 PM
Hi bguilbert,
You said that when you tried from the portal, the refund was happening. But from the API it is not. May I know which portal it was - account.authorize.net or sandbox.authorize.net? Also, can you please double check the following:
1. if the portal is account.authorize.net, then the API endpoint should be https://api.authorize.net/xml/v1/request.api and the transactionID is from this env.
2. if the portal is sandbox.authorize.net, then the API endpoint should be https://apitest.authorize.net/xml/v1/request.api and the transactionid is from this env.
To confirm if transaction id (with which you are trying to refund) exists on the environment, try using getTransactionDetails API (https://developer.authorize.net/api/reference/index.html#transaction-reporting-get-transaction-detai...
01-06-2018 08:12 PM
Well, please don't take this the wrong way but ... I freaking love you!
Apparently, my ensure-you-really-want-to-play-in-production" code really works! *rolls eyes*
Thank you so much!
01-07-2018 06:09 AM