1

I have a custom payment method that uses the cc-form to take debit/credit card payments.

After the user has entered their card details, they are re-directed to my controller with a hidden form, then to the 3dsecure page.

After 3dsecure, they are re-directed to the same controller and various logic is checked.

After the logic is valid, they are re-directed to the checkout success page.

This was working with Magento 2.2, but in 2.3.0 this is not working.

After placing order, I am re-directed to 3dsecure as normal, but on returning from 3dsecure, I am re-directed to the home page with

"Invalid Form Key. Please refresh the page."

1
  • I have the same issue.. Did you solve this issue? Apr 17, 2019 at 16:08

1 Answer 1

1

Your Response Controller must implement CsrfAwareActionInterface and 2 of its methods. Your response controller should be like this.Then only form key issues will fix. I have the same issue in paytabs payment method and resolved using this way

    use Magento\Framework\App\CsrfAwareActionInterface;
    use Magento\Framework\App\Request\InvalidRequestException;
    use Magento\Framework\App\RequestInterface;

    class CustomPaymentResponse extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface
    {

        /** 
         * @inheritDoc
         */
        public function createCsrfValidationException(
            RequestInterface $request 
        ): ?InvalidRequestException {
            return null;
        }

        /**
         * @inheritDoc
         */
        public function validateForCsrf(RequestInterface $request): ?bool
        {
            return true;
        }
       /**
         * Dispatch request
         *
         * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface
         * @throws \Magento\Framework\Exception\NotFoundException
         */
       public function execute()
        {
        //your response check
        }
    }

Your Answer

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

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