Laravel Redirect:to is ignored and not working

I was implementing Paypal with Laravel framework and when it came to performing redirect then it did not happen no matter what I tried.

I tried in controller something like

header('Location: https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . urlencode($token));

and

Redirect::to('https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . urlencode($token));

Turned out that manual is best friend like always and you have to use Redirect::to only in return statement like this

return Redirect::to('https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=' . urlencode($token));

Leave a Reply

Your email address will not be published.


*