I am developing a payment module.
I am trying to redirect to an external url after calling an API with curl.
The api returns a redirect url (https://…..com/…./..), which I would like to follow and continue with payment on the page it should open.
I am trying to do that from an Observer (before_save_order_payment)
I tried every possible way (resultRedirectFactory, _redirect(), header(“Location:”), etc)
but none of them redirects to that external url.
Sometimes it happens to redirect to the cart page… o_O
This is my first Magento 2 development, so I am not sure if doing that from the observer is the correct way.