I have Authorize.net Direct Post enabled on Magento 1.13 with the following settings:
Payment Action: Authorize Only
Test Mode: No
Gateway URL: https://test.authorize.net/gateway/transact.dll
During checkout, after entering test credit card information and clicking "Place Order"
I get a pop up alert saying:
"Response hash validation failed. Transaction declined."
What is causing this and how do I fix it?
Best Answer
As defined in app/code/core/Mage/Authorizenet/Model/Directpost.php, this exception is thrown if any portion of the below evaluates as false:
So, it's one of three things:
You have no
trans_md5
defined in the config treepayment/authorizenet_directpost/trans_md5
There is no login defined in
payment/authorizenet_directpost/login
isValidHash
is returning falseThe method
isValidHash
returns false because there is an issue with either the generated hash (e.g. your API Login/Key are wrong, generate a new one and re-enter) or the amount of the transaction somehow differs between Authorize and your system.The latter is less likely, but because
generateHash
inMage_Authorizenet_Model_Directpost_Response
uses the transaction amount as part of the hash, it's a potential factor here.