#Justin (Shades)
1 messages ยท Page 1 of 1 (latest)
Are you encountering any errors in the browser dev console or your server logs?
Wondering whether your server is not reaching the redirect, or if the browser isn't honouring it.
Console says the following:
Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received
DevTools failed to load source map: Could not load content for chrome-extension://ddlakobiikmpnaeakgbdeodclnmiablf/content/content.js.map: System error: net::ERR_BLOCKED_BY_CLIENT
How are you running this code and accessing it?
I have a custom built customer management program, built with PHP. I do not want to process payments directly on the website, I prefer to send customers to a secure site to collect payment, and use a webhook to update my customer account when payment is received.
Currently I use PayPal button code to do that, but I want to switch to Stripe instead.
Here's the code I've got
Here's the relevant code from the customer facing page, that just sends the information along to "sendToStripe.php" when customer chooses to pay
Ok, and are you hosting this locally with php -S 127.0.0.1:4242 --docroot=public like the quickstart guide suggests, or another pattern for your own application? Assuming you are, what do you logs tell you is happening in that sendToStripe.php file? (I assume thats where the Checkout creation is)
I'm on my live web server
developing in pages that aren't hyperlinked anywhere so customers can't accidentally stumble on them in the meantime - customers are still using my previous PayPal code
I'd suggest building & testing this in test mode offline first, but sure even in this case what do the logs from the server show is happening when you expect the cehckout session creation + redirect?
I'm not sure where I would find the logs you're asking for
Presumably on your server somewhere. You need to validate that you're actually reaching that Checkout session code, and handle any errors that might be happening. Unfortunately I don't know how your application or server works, so you'll need to use whatever debug techniques you use normally to trace where there might be errors.
Can you copy that price ID from your server code here?
I can use that to see if there are any Stripe request logs to shine some light
price_1MW2ofGaYFTIJfOAyHzEXvyS
Or you can look for errors here yourself: https://dashboard.stripe.com/test/logs/
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hmm ok I'm not seeing any requests at all for your account over the last couple of days
so it seems like that session create call is never happening
I agree, it's like the header code is simply being ignored
there's no attempt at refreshing the page and redirecting
This is the error log from my cPanel. I don't believe any of that is helpful
I suspect its failing earlier than that, but you'll need to get at some other logs showing the failure
I cant see secrets.php to confirm $stripeSecretKey is valid - one thing to try would be putting your test mode secret key in there as a string instead of a variable
(dont share any secret keys here)
I have the test mode Secret key in there within quotation marks. Wouldn't this be a string as you suggest?
I did a very simple test to see where the code was failing. I put an "echo" before this segment of code and it appeared properly on the screen.
When I placed the echo after this segment of code, it did not appear on the screen.
Therefore, this code must be the throwing an error somewhere. But this is exactly what is given in the quickstart guide, so where am I going wrong?
Are you able to get the details of that error? It's hard to speculate on the problem without that.
I'm not sure how I would? Is there code I could write into that "checkout_sesion"?
That's gotta be something within the Stripe files I downloaded from GitHub, who knows where within there the problem lies. \Stripe\Checkout\Session::create is not my code, so I don't know how I could analyze and debug it
Hello ๐
Taking over as synthrider needs to step away
Hello, thanks
There's a lot of context in this thread, so while I catch up, would you mind giving me a short summary of where you're currently at?
Just trying to figure out why I don't get redirected to Stripe with the code from the quickstart guide
Have you checked your web server log? There should be some indication of what's failing exactly
This is all I have
๐ค doesn't make sense.
There must be some kind of exception. The SDK doesn't usually fail silently.
Can you try adding a try catch block to see if you are able to catch the exception?
https://www.php.net/manual/en/language.exceptions.php#language.exceptions.examples
I think the issue is with your TLS certificate
https://github.com/stripe/stripe-php/issues/416#issuecomment-355960584
Hmm, OK I'll see if I can do something with that