#dev_api

1 messages ยท Page 1 of 1 (latest)

glossy coyoteBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฑ๏ธ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime!

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1212753327708835841

๐Ÿ“ Have more to share? You can add more detail below, including code, screenshots, videos, etc.

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question. Thank you for your patience!

scarlet orioleBOT
sullen karma
#

๐Ÿ‘‹ happy to help

#

do you happen to have a request that is failing?

keen lake
#

hello i don't have a request failling

sullen karma
#

this means that there's a missing environment variable or something

#

but it's not Stripe related but rather a configuration on your side

keen lake
#

i use Stripe::setApiKey() for the secret key, its right no?

sullen karma
#

try to test whether the key exist or not

#

or an empty string or something

#

oh wait

#

that's the Stripe Checkout page

#

would you mind sending me the link?

keen lake
#

i sending it to you in pm

sullen karma
#

you can send it here

sullen karma
#

this means that the checkout session you're trying to access has expired

#

oh no actually it's something else

#

the url is missing a part of it

keen lake
#

ok what can i do?

sullen karma
#

how are you redirecting to the Checkout Session?

keen lake
sullen karma
#

I think it's better if you send the url to the frontend and redirect from there

scarlet orioleBOT
sullen karma
#

for some reason the redirection from the backend is splicing the URL

keen lake
#

i have this too

languid olive
#

๐Ÿ‘‹ stepping in

#

So you see that error when you attempt to redirect after the Checkout Session is created?

keen lake
#

hello ,when i tried to pay the bills

languid olive
#

When you try to complete the Checkout Session?

keen lake
#

when i tried to access the check out this message appears: Something went wrong

The page you were looking for could not be found. Please check the URL or contact the merchant.

languid olive
#

So when your frontend attempts to redirect?

keen lake
#

its the same

languid olive
#

You aren't really giving me much information to work with here. I need you to be more detailed to help you.

What happens when you use:

header("Location: " . $checkout_session->url);```

Instead of `return $this->redirect()` in your code?
keen lake
#

what is $checkout_session ?

languid olive
#

Sorry that would be $session in your case

keen lake
#

no problem i have a error with symfony framework

languid olive
#

Ah symfony won't let you use that to redirect?

#

So you have to use redirect() specifically when using symfony?

#

I'm not familiar with symfony at all

keen lake
#

ok i tried with return header("Location: " . $session->url); but i have an error

languid olive
#

What is the error?

keen lake
#

App\Controller\PurchaseController::pay(): Return value must be of type Symfony\Component\HttpFoundation\Response, null returned

#

yes with my older website it work!

languid olive
#

Can you just return an empty response to symfony after you perfrom that redirect?

#

What do you mean "with my older website it work"?

#

It sounds like the issue really is around how you are setting your API key for this code in that case.

#

Have you hardcoded the API key in the same file for a test?

keen lake
#

i use \Stripe\Stripe::setApiKey('mysecretAPIkey) in my function

#

i mean i used the same function and it work!

keen lake
languid olive
#

If the only thing you replaced is your secret key then I'd recommend checking on that secret key in the Dashboard and ensuring that you are grabbing the full key

keen lake
#

its grabbing the full key

languid olive
#

Alright well I can't really help you any further then. It is something with your framework not grabbing that API key as it is a clear error about that. So I can only recommend at this point building a clean project and testing that way to ensure that works, and then doing a deeper comparison to the project that you have already built.

keen lake
#

ok thank you