Skip to content
Advertisement

Stripe php integration Error: ReferenceError: sessionId is not defined

I’m stuck at integrating stripe’s prebuild payment gateway to my project.

I’m coding very simple Eshop (without login/registration and shopping cart) just a simple project with a form and stripe checkout as a way to pay…

I was following official stripe documentation but I struggle to find an answer how to implement their “simple prebuilt checkout page” to procedural PHP.

Currently I’m stuck on getting this error…the provided code is what I have used from their official documentation “still getting error ReferenceError: sessionId is not defined in the console in devtools ://

Also IDK how to configure endpoint on my server when coding it all without PHP framework such as Slim/Laravel…al examples provided by stripe use Slim framework when configuring endpoints….any ideas?

JavaScript
JavaScript
JavaScript

Advertisement

Answer

I think you need to replace return stripe.redirectToCheckout({ sessionId: sessionId}); with return stripe.redirectToCheckout({ sessionId: session.sessionId});

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement