Hi,
I am the same problem for Woocommerce subscription.
@lucanos code looks very good with extra security. But it does not work with woocommerce Subscription.
It keeps redirection to this page and asking for login again ..?wcs_redirect=pay_for_order&wcs_redirect_id=122
So I guess it needs some additional code to work with Subscription orders.
@ptravassos your code need another plugin (WP_Auth0) to be installed and activated.
Thanks…