Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

lara28580's avatar

Need to solve Stripe InvalidRequestException

I am trying to integrate the prebuilt checkout page from stripe for my customers. The problem ist after I am redirected from the checkout page back to my app I always get the following exception

Stripe\ Exception\ InvalidRequestException

No such payment_intent: 'success'

Here is my code

			\Stripe\Stripe::setApiKey(env('STRIPE_SECRET'));
            $checkout_session = \Stripe\Checkout\Session::create([
                'line_items' => [[
                    # Provide the exact Price ID (e.g. pr_1234) of the product you want to sell
                    'price' => 'price_1LXqzHBN77QztmSfyftj7hpG',
                    'quantity' => 1,
                ]],
                'mode' => 'payment',
                'success_url' => route('payment.success'),
                'cancel_url' => route('payment.cancel'),
            ]);

        redirect($checkout_session->url, 302, [
            'Content-Type: application/json',
            'HTTP/1.1 303 See Other',
            "Location: " . $checkout_session->url
        ]);

Maybe someone could help?

0 likes
1 reply
lara28580's avatar
lara28580
OP
Best Answer
Level 10

Solved! Had to change the route.

Please or to participate in this conversation.