I am working for Magento 2 right from its first version. Till now for payments i have used only Paypal Express Checkout. But now there is requirement to integrate Authorize.net direct post. And i have tried to integrate it using sandbox credentials.

Now when i am on checkout page selecting Authorize.net to make payments by using sandbox sample card number e.g. : - American Express Test Card: 370000000000002 , When i click on place order it keeps on showing loader. But if i can see in admin panel under Sales > Order m It shows the order that i have just placed.

I have searched allot and found some people have posted the same issue , but they have also mentioned the PHP version as 7.0.x where they are getting issue. e.g here

But i am using PHP Version 5.6.20 and also I have got this issue first with Magento 2.0.6 version. Now i have done fresh Magento 2.0.7 installation on new server, but the issues is still there

My admin panel configuration settings for Authorize.net are

Test Mode : Yes

Gateway Url : https://secure.authorize.net/gateway/transact.dll

I have even tried with


Transaction Details Url : https://api2.authorize.net/xml/v1/request.api

Debug : Yes

Now when i have checked debug.log

it is saying

[2016-05-27 12:35:03] main.DEBUG: cache_invalidate:  {"method":"POST","url":"http://example.com/authorizenet/directpost_payment/place/","invalidateInfo":{"tags":["catalog_category_3","catalog_category"],"mode":"matchingAnyTag"},"is_exception":false} []
[2016-05-27 12:35:03] main.DEBUG: array (
  'request' => 
  array (
    'x_version' => '3.1',
    'x_delim_data' => 'FALSE',
    'x_relay_response' => 'TRUE',
    'x_test_request' => 'TRUE',
    'x_login' => '****',
    'x_method' => 'CC',
    'x_relay_url' => http://example.com/authorizenet/directpost_payment/response',
    'x_type' => 'AUTH_CAPTURE',
    'x_fp_sequence' => '2',
    'x_invoice_num' => '000000002',
    'x_amount' => 5.0099999999999998,
    'x_currency_code' => 'USD',
    'x_tax' => '0.00',
    'x_freight' => '5.00',
    'x_first_name' => 'Dinesh',
    'x_last_name' => 'Saini',
    'x_company' => '',
    'x_address' => 'test',
    'x_city' => 'California',
    'x_state' => 'Alabama',
    'x_zip' => '90001',
    'x_country' => '',
    'x_phone' => '1234567890',
    'x_fax' => '',
    'x_cust_id' => '',
    'x_customer_ip' => '',
    'x_customer_tax_id' => '',
    'x_email' => '[email protected]',
    'x_email_customer' => '1',
    'x_merchant_email' => '',
    'x_ship_to_first_name' => 'Dinesh',
    'x_ship_to_last_name' => 'Saini',
    'x_ship_to_company' => '',
    'x_ship_to_address' => 'test',
    'x_ship_to_city' => 'California',
    'x_ship_to_state' => 'Alabama',
    'x_ship_to_zip' => '90001',
    'x_ship_to_country' => '',
    'x_po_num' => '',
    'x_fp_timestamp' => 1464352503,
    'x_fp_hash' => '27827498413496cd9ad6ed247e9688f3',
) {"is_exception":false} []

Can anyone please help , is there anything wrong in my configuration or i have tried with something else.


7 Answers 7


I thing you are working in localserver(localhost). There problem in getting response in local machine. Try to any live server. I had same probelm but when tried in live it workes fine.

  • Thanks for your reply. But i am working on live server and getting this issue Jul 28, 2016 at 6:06
  • Did you flush all cache and also try with static content deploy? and also tell me that are you getting transaction in unsettled transaction at authorized? Jul 28, 2016 at 13:50
  • Does this worked for you? Aug 2, 2016 at 11:01
  • yes i have done everything and getting transaction in unsettlled account and even getting receipt email Aug 3, 2016 at 9:56
  • Now it seems weird to hear that this now work because I was have same problem but after working on live it works and order placed successfully. Even though I found any thing I will let you know. :) Aug 3, 2016 at 12:21

I encountered a similar issue with magento ee 2.0.15. After some creative debugging, I traced my problem to a seemingly unrelated configuration setting: Stores::Configuration::Sales::Sales Emails::General Settings::Asynchronous Settings. What I found is that when "transact.dll" posts to your site at /authorizenet/direct_post/response, and the charge was successful, magento attempts to send an email to the user if the setting above is disabled. This email uses the magento layout system, and loads it's own layout. The problem is that the same "layout" object is used later in the request cycle, and when you expect it to load the layout update "authorizenet_directpost_payment_response.xml", it doesn't because the builder checks if the layout was already loaded, which it was. This results in an empty layout and a 0 byte response. Authorize.net's "transact.dll" interprets this as a timeout even though the headers were sent, and the content-length was specified as 0 bytes.

Following up on this. If you do change the above email setting, then sales confirmation emails will be sent via cron job. If your site is served from the "pub" directory, then you will need to set the secure and unsecure base media and static paths in the stores configuration. I have found that using the placeholder syntax is sufficient: "{{unsecure_base_url}}static/" and "{{unsecure_base_url}}media/" for example.

  • This solved our problem. As unlikely as it seems. Makes sense. Just for other people: Cloudflare, AWS ELB, Nginx, Magento 2.
    – Ram Iyer
    Feb 13, 2018 at 18:57
  • Spent 6 hours and was really close and searching with what I learned lead me here and this answer, thank you. Still a problem in 2.2 Magento as well.
    – user44406
    Dec 26, 2018 at 7:58

STORES -> Configuration -> SALES -> Payment Methods -> Authorize.net Direct Post > Test Mode, change it to "No"

  • is it working for you , its not working for me even after changing test mode to no Jul 13, 2016 at 10:08

I am having the identical problem.

Does anyone have Autorize.net working in Magento 2.1.2?

I looked into the exception.log and found

2017-01-31 19:41:05] main.CRITICAL: Magento\Framework\Exception\LocalizedException: The transaction was declined because the response hash validation failed. in vendor/magento/module-authorizenet/Model/Directpost.php:550

Any ideas/suggestions/prayers ?


Please do on https domain URL and try with live authorized account detail. It will work perfectly.



In my case I used too long md5 hash key so it was giving server error. Please try to shorter key in md4 hash key. It work


In my case it was the SSL certificate that was causing the problem. I replaced it and everything started working. It took me 5 days to figure out this was the issue. There were no errors pointing to this being the problem in the server logs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.