I'm not sure ... perhaps with this ?
return redirect()->withInput();
https://laravel.com/docs/9.x/redirects#redirecting-with-flashed-session-data
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, I have a problem with transferring data between functions and the final redirection to a specific address. Briefly, how my application works:
My web.php
Route::get('dodaj/premium',[CompanyController::class, 'addFormPremium']);
Route::post('dodaj/premium',[CompanyController::class, 'storePremium']);
public function storePremium(Request $request)
{
//Everything is fine with this function, the data is saved and the ID is passed on with:
$this->paymentCheckout($company->id);
}
public function paymentCheckout($id_company)
{
try {
Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
$product = Stripe\Product::retrieve(
'XXX',
[]
);
$price = Stripe\Price::retrieve(
$product->default_price,
[]
);
$portal = Stripe\Checkout\Session::create([
'success_url' => 'success',
'cancel_url' => 'cancel',
'line_items' => [
[
'price' => $price->id,
'quantity' => 1
],
],
'mode' => 'payment',
]);
$id_session = $portal->id;
$payment_url = $portal->url;
return redirect()->to($payment_url);
}
The data is saved, but not transferred to the URL. After executing dd (); the address is 100% generated by the code because it is saved in the database
I guess the problem is that I don't have any reference to the 'paymentCheckout' function in my web.php - could that be true?
Please or to participate in this conversation.