0

I would like to know the possibility; when a customer clicks on place order and authorize.net rejects the payment giving a Gateway error, but the order is still created in the back-end with a Cancel status. I do not want the order to be placed/created, when the payment is rejected by Authorize.net, I want it to be rolled back.

Can anyone please share their thoughts on how we can possibly achieve this?

1

The canceled order is a result of how Authorize.Net Direct Post works.

Magento has to keep track of the order data through the payment process. When the customer chooses Authorize.Net Direct Post and clicks 'continue', Magento creates the order in a 'payment pending' status. The transaction still has to go through at Authorize.Net, and it may or may not. Magento won't know until Authorize.Net sends the transaction results back, at which point the order status is updated. And for record purposes (and compliance with laws in some countries), Magento doesn't delete orders under any circumstances.

PayPal Express works the same way.

You could add a custom observer to delete the order instead of changing the status when an Authorize.Net response fails, or you could switch to a third-party Authorize.Net payment method that doesn't use Direct Post.

The response handling for Direct Post is in \Magento\Authorizenet\Model\Directpost->processOrder().

  • Thanks for your response Ryan. Really appreciate it, I will look into your advice see if I can make it work. – Moiz Sadiq Aug 1 '17 at 16:19
  • Did you have any joy, Moiz? – Geat Aug 4 '17 at 0:02
  • Hello @Ryan can you please tell me any third-party Authorize.net payment method? – Abbas Jun 21 '18 at 23:58
  • @Abbas Try Magento Marketplace: marketplace.magento.com/catalogsearch/result/… – Ryan Hoerr Jun 22 '18 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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