P粉6172377272023-08-08 00:58:44
You can return the URL instead of redirecting:
return response()->json([ 'redirect_url' => $session->url ]);
and redirect the user from the client. You will get the redirect url in the JSON response. Handle it accordingly.
Assuming the client uses AJAX, you can use the following command to redirect the user:
success: function (data) { window.location.href = data.redirect_url; }