Redirect Laravel to Stripe session URL
P粉897881626
2023-08-07 18:33:06
<p>After creating the Stripe checkout session in my controller, I am trying to redirect it by using </p>
<pre class="brush:php;toolbar:false;">return redirect($session->url);</pre>
<p>But I keep getting a CORS error. <br /><br />I can add the URL and go there manually without any problems. <br /><br />However, according to this article</p><p><br /></p>
<blockquote>
<p>Getting a CORS error when trying to onboard users to Stripe Connect with Node.js</p>
</blockquote>
<p>The solution is to return the URL from the server to the client and let him redirect from there. <br /><br />Can anyone tell me how to do this in Laravel?</p><p><br /></p>
You can return the URL instead of redirecting:
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: