magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.53k stars 9.31k forks source link

Magento 2.1 Authorize.net not redirecting to failure or success page after migration from 2.0.4 to 2.1 #5642

Closed arunkrsigmainfo closed 8 years ago

arunkrsigmainfo commented 8 years ago

Steps to reproduce

Go to http://www.kidsafetystore.com
Add Any Product to cart
Proceed to checkout
Select Credit Card Authorize.net 
Enter the below details Card No : 4111111111111111 Any Expiry Date Any CVV

Expected result

  1. Redirect to failure page

    Actual result

  2. Loader just loading magento 2 1 authorize net error
gamort commented 8 years ago

@arunkrsigmainfo Your payment processor setup is invalid. Moreover as with the 2.0 bug you had checking out from an http form while submitting via authorize.net directpost is not supported.

In this case at least the error message is quite clear: your server is blocking authorize.net from confirming the order.

Steps to confirm:
Use Google chrome Go to Checkout, enter shipping information and continue to payment page. When the payment page loads, immediately right click on the screen and choose "inspect this element" for any element[in order to activate the developer console] On the developer console go to the "network" tab Make sure that "preserve log" is enabled Enter your payment information as above Click submit Allow authorize.net a minute to attempt and fail to process the payment Scroll down the list of and find the attempted connection to "transact.dll" on an authorize.net domain. Click on this transaction Go to "Response" tab Note the response:

<html>
    <head>
        <script>
                    window.location="http://www.kidsafetystore.com/authorizenet/directpost_payment/redirect/x_invoice_num/000030012/success/0/error_msg/Gateway error: An error occurred during processing. Call Merchant Service Provider./controller_action_name/directpost_payment/";
                </script>
    </head>
    <body></body>
</html>

Magento2 is doing an ajax post of the payment information to authorize.net. Authorize.net in turn will connect to http://www.kidsafetystore.com/authorizenet/directpost_payment on your server to inform the server that the payment succeeded or failed. Whatever your server sends back is passed directly back to the web client. Your server is supposed to provide a bunch of json code which the web client can then process.

Issue 1: Your server did not respond. So instead of a json response, the web client was sent html. Issue 2: The web client is unable to parse and process html, so it is stalled and will do nothing. Issue 3: Even though the above MIGHT work with a sandbox account, authorize.net will NOT connect to your server for live payments over http - the connection MUST be secure.

alena-marchenko commented 8 years ago

Hi @arunkrsigmainfo

We've created MAGETWO-56932 internal ticket regarding this issue. Thank you.

arunkrsigmainfo commented 8 years ago

Thanks a lot. Please let me know once its fixed or any fix as we are facing this many client even after we are using Magento 2.1.

We have a lot of clients Migrating from M1 to M2 and we would suggest that because of performance and these issues the clients started re-thinking.

Hope you understand.

Thanks and regards,

Arun Kranth Rayudu Technical Architect Magento Certified Developer || Magento Certified Solution Specialist arun.kr@sigmainfo.net arun.kr@sigmainfo.net| www.sigmainfo.net http://www.sigmainfo.net/ | +91-9535543354 [image: Description: unnamed]

On Wed, Aug 31, 2016 at 7:38 PM, Elena Marchenko notifications@github.com wrote:

Hi @arunkrsigmainfo https://github.com/arunkrsigmainfo

We've created MAGETWO-56932 internal ticket regarding this issue. Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/5642#issuecomment-243775491, or mute the thread https://github.com/notifications/unsubscribe-auth/AMD2HVwdH-Bh9xmQMdqcc_2QwVwe9xrzks5qlYrOgaJpZM4JMm73 .

jernejh commented 8 years ago

What's the progress regarding this indefinite spinner problem?

Since, I am having exactly the same problem (https://github.com/magento/magento2/issues/6474#issuecomment-244588997), and I really need a solution, I tested this thoroughly:

  1. The behavior was the same in 2 cases: 1) 2.1.1 version, upgraded from 2.0.9 and 2) 2.1.1 fresh install
  2. If I use wrong settings in the backend regarding the Merchant MD5, Transaction Key and API Login ID, I get to see the Warning "Sorry, but something went wrong. Please contact the seller." (https://github.com/magento/magento2/issues/5934) in the new window, and after clicking the OK button, I am correctly redirected to home page.
  3. As soon as I use the correct authorize.net settings, I get the "An error occurred on the server. Please try to place the order again." warning for a short while, and after that THE INDEFINITE SPINNER. In this case, in the authorize.net interface, I am seeing a declined transaction - so the settings must be correct and transaction itself is successfully forwarded from Magento to authorize.net.
  4. I am using HTTPS for all pages.
dyushkin commented 8 years ago

Hi @arunkrsigmainfo!

Fix for MAGETWO-56932 ticket is already merged to develop branch, please wait until to next release to apply it. Closing the issue, please feel free to reopen if the issue still reproducible for you.

jvreeken commented 8 years ago

@dyushkin where might I find the actual fix for this problem without completely pulling the develop branch? there are many bugs in v2.1.1 that I've already applied patches for to fix bugs that I don't want to have to go an repatch after pulling the latest develop... if you could let us know what exactly fixes the issue, that would be great. thank you.

I think it might be that we are forcing ssl on all pages... no idea...

Here is my issue: https://www.dropbox.com/s/5yl4v9fj1q37cuo/Payment-Hangs-Magento2.1.1.mp4?dl=0

nagamani-sigma commented 8 years ago

@dyushkin I need to fix this issue, as my client is asking to fix the issue as soon as possible, can you please share the files which you have committed for the fix then that would be great.

arunkrsigmainfo commented 8 years ago

@dyushkin : Can you please atleast provide the commit ID so I can see what changes you made and put a patch untill the next stable release as our client uses only Authorize.net and loosing lot of business and he is thinking to move off from magento to someother ecommerce.. Its really urgent for us.

Gammatesting123 commented 8 years ago

Magento2.1.1 still "400 (Bad Request)" issue generate while place order using custom payment method...magneto2.1.0 in working perfect but magneto2.1.1 in getting this issue. payment

jvreeken commented 8 years ago

{"message":"An error occurred on the server. Please try to place the order again.","trace":"#0 \/Users\/jvreeken\/Sites\/morganjewelers\/vendor\/magento\/framework\/Interception\/Interceptor.php(146): Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(15699, Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address))\n#1 \/Users\/jvreeken\/Sites\/morganjewelers\/var\/generation\/Magento\/Checkout\/Model\/PaymentInformationManagement\/Interceptor.php(26): Magento\Checkout\Model\PaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)\n#2 [internal function]: Magento\Checkout\Model\PaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder(15699, Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address))\n#3 \/Users\/jvreeken\/Sites\/morganjewelers\/vendor\/magento\/module-webapi\/Controller\/Rest.php(307): call_user_func_array(Array, Array)\n#4 \/Users\/jvreeken\/Sites\/morganjewelers\/vendor\/magento\/module-webapi\/Controller\/Rest.php(216): Magento\Webapi\Controller\Rest->processApiRequest()\n#5 \/Users\/jvreeken\/Sites\/morganjewelers\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(37): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#6 \/Users\/jvreeken\/Sites\/morganjewelers\/vendor\/magento\/framework\/App\/Http.php(135): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#7 \/Users\/jvreeken\/Sites\/morganjewelers\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#8 \/Users\/jvreeken\/Sites\/morganjewelers\/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#9 {main}"}

dmcmillin commented 8 years ago

I am using m2.1.1 directly from https://www.magentocommerce.com/download I am getting the same issue. Since I didn't install using git I am not wishing to screw things up on my server. Can you push out a patch for those who can make use of the update feature?

dmcmillin commented 8 years ago

@alena-marchenko - It seems like this is a huge issue for many customers and doesn't look like it is actually fixed. Any updates? Thanks!!!

brianschroeter commented 8 years ago

@alena-marchenko My client is being impacted by this bug as well, and I'm not sure how to assist them. At this time, they're basically dead in the water, with no ability to collect payments. Is there a patch available for this?

Any help is much appreciated!

jvreeken commented 8 years ago

Not fixed in v2.1.2 I am still getting: "An error occurred on the server. Please try to place the order again."

Console shows 400 (Bad Request)

brianschroeter commented 8 years ago

Confirmed. I'm still receiving the error after the latest upgrade as well.

Gammatesting123 commented 8 years ago

Not fixed in v2.1.2 I am still getting: "An error occurred on the server. Please try to place the order again."

Console shows 400 (Bad Request)...still wait for the solution of this error.

nagrgk commented 8 years ago

Hi aLL,

ANY UPDATES ON THIS? IS THIS FIXED IN MAGENTO 2.1.2?

brianschroeter commented 8 years ago

@nagrgk This has not been resolved in 2.1.2.

arunkrsigmainfo commented 8 years ago

Guys : I tried commenting the code $this->checkTransId(); in line number 689 in vendor/magento/module-authorizenet/Model/Directpost.php and it started working in server but in local its still rejecting as Magento is not responding with a patch or fix I tried to debug and this fix started working in server and for client its working and got going. I have overridden the vendor module and made a module. Please contact me for patch.

brianschroeter commented 8 years ago

@arunkrsigmainfo How can I get in touch with you? :-) I'd love for you to provide the patch to me, as my client is having a very tough time. Thanks!

arunkrsigmainfo commented 8 years ago

@brianschroeter : please send your details to arun.kr@sigmainfo.net and we can talk further on this.

brianschroeter commented 8 years ago

@arunkrsigmainfo Thanks! Email sent.

jvreeken commented 8 years ago

Weird,

I got it to work on local, but not on staging after I tried commenting the code $this->checkTransId(); in line number 689 in vendor/magento/module-authorizenet/Model/Directpost.php like @arunkrsigmainfo suggested... I'm using a test key on local and a live key on staging: https://www.dropbox.com/s/6dt0kh7rgikvtt3/Screenshot%202016-10-18%2017.26.48.png?dl=0

I think it has something to do with the use of the type of key you are using. I cannot get a live key to work in test mode, It works in live mode with real cc data.

graffxdesign commented 8 years ago

Hi Guys,

I am having the same issue, friend has asked my help and I can't believe there is not solution. His partner is furious and I am not sure what to tell them, can anyone take a look and let me know if you see the issue.

I tried commenting that line and it didn't work. It looks like everything is sent to auth.net but the response is not being read by M2.

http://tinyurl.com/z6tmv5c

Console response <HTML><BODY><TABLE Width="600"><TR><TD>An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card. <BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;This transaction has been declined. <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR></TD></TR></TABLE></BODY></HTML>

Message from Auth.net email

Authorize.Net Merchant,
Your script timed out while we were trying to post transaction results to it.
  Transaction ID: 40013774159
Transaction Result: This transaction has been declined.

The user sees a generic message then clicks [ok] and they are logged out and sent to a blank cart. The order DOES go into Magento as PENDING.

brianschroeter commented 8 years ago

I've tried just about everything, and couldn't get this to work. 50+ hours in, we've opted to just use BrainTree. That works fine for our needs.

graffxdesign commented 8 years ago

Thanks @brianschroeter,

Yeah I am 20 hours into it myself, mindblowing that we cant figure it out. It is like magento is not handling the response.

brianschroeter commented 8 years ago

@graffxdesign

Any time! I tried the following...

I found that it will work if you turn test mode on. However, the card won't be charged in test mode. It will also work in sandbox accounts, but again that is not going to result in a charge.

Using a live account with a real credit card failed every time. Since they've closed this, and it's not fixed in 2.1.2, I don't know when or if they'll ever fix it.

I've found threads dating back to April, where people had this issue. No resolution was provided then either. Should we just accept that this is broken for good? I almost lost a very large maintenance contract due to this bug! That may not seem like a big deal, but this is how I feed my family. Seeing as I'm not alone, I'm surprised this isn't a higher priority.

graffxdesign commented 8 years ago

@brianschroeter I understand fully, I have a huge client that is moving to M2 and if I didn't know this right now I could have lost the client on the new year.. and it would devastate my family until I found another.

Thank you very much for the information it is very helpful and I will go back to the CC company to find another solution!

jvreeken commented 8 years ago

I think magento not fixing this is just a ploy for them to get people to switch to braintree as that is owned by paypal which is owned by ebay which owns magento.

brianschroeter commented 8 years ago

@jvreeken Very possible! However, I will say that Braintree worked incredibly well out of the box. Go figure, lol.

jernejh commented 8 years ago

@brianschroeter , @jvreeken - it wouldn't be a problem at all, if Braintree wouldn't be so restrictive for smaller companies outside US (company of one of my clients got refused by Braintree. On the other hand, they had no problems registering with Authorize.net). So, now what, wait over a month for 2.1.3 release which won't fix the problem again? Magento development team, c'mon 👎

graffxdesign commented 8 years ago

@brianschroeter do you think someone can just make a direct post module? I would think that would be the best solution.

brianschroeter commented 8 years ago

@jernejh Ah, that certainly is a problem. I don't know when / if this'll be fixed, as it was apparently fixed (as per the comments above), but there is no commit referencing this ticket. Furthermore, the dev files do not fix this issue (I've tried), and the last changes to the authorize.net module had nothing to do with this.

@graffxdesign That was the route that I was going to take, until my client was approved for Braintree. Heads up -- it was supposed to take 24 hours, but took 5 days! 5 days of downtime. 5 days of stress, and 5 days of hearing, "I thought Magento was supposed to be good...".

Guys -- we can't continue to recommend this platform to our clientele, when bugs are not even addressed. I understand that this is a community effort, but certainly someone could speak up on this. The "patch" mentioned above did not work for our live sites, and editing core files is not recommended anyway. What are we as developers supposed to think, when our bug reports are ignored?

Rich07082 commented 8 years ago

Does anyone know what was the last version of 2.x.x that worked?

I see most people talking about a problem with Authorize.net but I just wanted to say I'm having the same issue using Paypal payflow.

I've also tried Braintree in sandbox mode and was able to get guest orders through with only one address line but if I tried to login with an account that was created already the order would fail with the error message.

Has anyone be able to get it to work without a workaround?

Rich

jernejh commented 8 years ago

Maybe I was not clear in previous posts, in both 2.1.1 and 2.1.2 I am still getting trouble with the infinite spinner for failure scenarios (entering test visa card number for instance), but for valid credit card numbers I was able to successfully finish the payments through Authorize.net.

graffxdesign commented 8 years ago

So I tried it in the admin backend and it does show the error at least and the wheel doesn't spin for ever. I still got the standard email from auth.net saying that the script timed out. So I tried to it with a valid card, my card was charged but I got this error below. It seems like the response from auth.net is getting lost when it is supposed to hit magento.

Order saving error: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '000000026-1' for key 'SALES_ORDER_INCREMENT_ID_STORE_ID', query was: INSERT INTOsales_order(state,status,protect_code,shipping_description,is_virtual,store_id,customer_id,base_discount_amount,base_grand_total,base_shipping_amount,base_shipping_tax_amount,base_subtotal,base_tax_amount,base_to_global_rate,base_to_order_rate,discount_amount,grand_total,shipping_amount,shipping_tax_amount,store_to_base_rate,store_to_order_rate,subtotal,tax_amount,total_qty_ordered,customer_is_guest,customer_note_notify,customer_group_id,quote_id,base_shipping_discount_amount,base_subtotal_incl_tax,base_total_due,shipping_discount_amount,subtotal_incl_tax,total_due,weight,customer_dob,increment_id,applied_rule_ids,base_currency_code,customer_email,customer_firstname,customer_lastname,customer_middlename,discount_description,global_currency_code,order_currency_code,shipping_method,store_currency_code,store_name,customer_note,total_item_count,discount_tax_compensation_amount,base_discount_tax_compensation_amount,shipping_discount_tax_compensation_amount,shipping_incl_tax,base_shipping_incl_tax,gift_message_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, '2016-10-11 00:00:00', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)

graffxdesign commented 8 years ago

@jernejh So on a successful transaction it worked fine for you?

jernejh commented 8 years ago

@graffxdesign - I just tested 2.1.2 version and I was able to get the payment through. so, both 2.1.1. and 2.1.2 have the same behaviour - for positive scenario (valid credit card number), the payment gets through successfully, while for negative scenario (invalid test Visa number 4111111111111111), I am experiencing indefinite spinner problem - https://github.com/magento/magento2/issues/6474

Rich07082 commented 8 years ago

Jernejh, Is that with one or two address lines?

Do you have any other work around that your using?

I've been unable to get payments to go through trying multiple options?

How about guest checkout or logging in with a previously created account with two address lines?

Rich

jernejh commented 8 years ago

Street address was in one line. In 2.1.1, I was able to do successful payments for both guest and logged in users. This time (for 2.1.1) I tested only for guest user - it worked. I never tried two address line scenario.

@Rich07082 what do you mean by workaround? I was not messing with Magento core code,

I ticked off just the following security options in authorize.net:

Rich07082 commented 8 years ago

what i meant by a work around was using only one address line instead of the two default.

Rejecting the CCV code value not matching I would consider a work around. I would think you'd want to use this for fraud protection.

Transactions not submitting billing address I would consider a work around also being you would want the billing address submitted for zip or avs verification.

Rich

graffxdesign commented 8 years ago

Okay, so I think at this point we need to have someone build a direct post module that we can all use. Do any of you have any developers that are up for the task asap? I can throw some cash in if someone wants to handle the programmer, or if you have one I can manage him and give you all the files when it is complete.

graffxdesign commented 8 years ago

Not sure this is the issue, but it looks like it might be sending the month as single digit, maybe that is causing an isssue? I will test it out.

graffxdesign commented 8 years ago

So we fixed half of the issues, it will now process a payment and send you to the success page, it will also refresh the page after a failed transaction. The issue is with the 'region language detect'. I will get you more info ASAP.

jvreeken commented 8 years ago

@graffxdesign please share your fix/workaround :) we are still having problems in live mode for failed transactions.

jwallb40 commented 8 years ago

Yes, any information @graffxdesign would be appreciated, as we're stuck in the same boat.

graffxdesign commented 8 years ago

Hi, I paid another programmer to find the error, he is going to send me the files and when he does I will post them asap.

graffxdesign commented 8 years ago

On the Currency.php the local is defaulting to 'NULL', you can set your default local on line 106.

        if (is_array($options)) {
            $this->setLocale($locale);
            $this->setFormat($options);
        } else if (Zend_Locale::isLocale($options, false, false)) {
            $this->setLocale($options);
            $options = $locale;
        } else {
            $this->setLocale('en_US');
        }
graffxdesign commented 8 years ago

Anyone else not able to log onto github? I am getting server not found.

Anyway, I tried a successful order in the admin backend, I was told that it uses M1 code in the admin area, but I am getting an error.

An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card. The referrer, relay response or receipt link URL is invalid.

Ctucker9233 commented 8 years ago

@dyushkin @alena-marchenko What is the commit number for the fix?