#BarrelRider
1 messages Β· Page 1 of 1 (latest)
Do you have a screenshot of the error?
sure gimme a sec
basically all I am doing is getting the URL and pushing user to stripe page, maybe I am not understanding what the real problem here is
Ah! Okay, so it looks like you're trying to redirect via XMLHttpRequest. Are you using Javascript at all? Or just PHP+Laravel?
I am using JS too (Vue3 + InertiaJS) however I thought that if I just jam that into routes it will be easier so I did it like that:
Route::get('/account/my-subscription',function (Request $request) {
return redirect()->away(auth()->user()->billingPortalUrl(route('dashboard')));
})->name('stripe.billing-portal');
I can pass to URL to the frontend and try from there, is that going to be better?
Exactly! That's why I asked if you were using JS. So yeah, the problem with using XMLHttpRequest that it's designed to make a request, get a response back, and then you do something with the response in your code. It's not meant to be used with server-side redirects. Additionally, they only work when making requests to/from the same origin that the userβs app was loaded from (hence the CORS error)
So yes: pass the URL to the frontend and perform a regular HTTP redirect
Yeah I thought I will have to add my origin in cors settings on stripe page. Ok that is totally ok and makes sense. Thanks for that. You guys ahve an excellent support I must say!