#_php-server-error
1 messages Ā· Page 1 of 1 (latest)
š Welcome to your new thread!
ā²ļø 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.
ā±ļø We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
š 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/1326682907749912606
š Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, are you able to review this document, https://support.stripe.com/questions/how-to-fix-syntaxerror-unexpected-token-in-json-at-position-0 please?
Thank you . I am going to check
Still.. I can not proced it.
Hi š
I am stepping in as my colleague had to go
Hello !
First I want to point out that you have provided your full secret key and this is a public forum
You should never do this
please roll your key immediately
Thank but this is test key,
Still, never do this and please roll your key immediately
Okay but there should only be one line that is throwing the error you are reporting. Which line is it?
Most likely this one
const result = await response.json();
but I want to be sure we're on the same page
When one error is resolved, the next error appears.
What error are you referring to?
What is the exact error message you are currently receiving and which line of code triggers this error?
Required data is missing.
What data? What is the code that is generating this error?
I don't know which line the error is related to. Also, I can't determine whether the issue is with the frontend index.html or the backend charge.php.
Where is this error showing up? Do you only see it in your browser console or does it show up in your PHP server logs?
That appears to be coming from your front-end where you are specifically calling alert(). This is something your code is doing
If this is an error your PHP code is passing back to your front-end, you need to capture/log that in your PHP code
Do you see API requests being created in your Stripe Dashboard logs?
https://dashboard.stripe.com/test/workbench/logs
yes
this error comes from this (backend)
// ā
åæ
é ćć¼ćæć®ćć§ććÆ
if (empty($email) || empty($stripeToken) || empty($subOption) || empty($amount)) {
http_response_code(400);
echo json_encode([
'status' => 'error',
'message' => 'åæ
č¦ćŖćć¼ćæćäøč¶³ćć¦ćć¾ćć',
'received_data' => compact('email', 'stripeToken', 'subOption', 'amount', 'upsell')
]);
exit;
}
Okay so where is the error being raised?
Are you making a request to the Stripe APIs? Or is the error raised before that?
maybe it comes from 'message'
I recommend you add more logging to your code to find out.
How can I do that ?
I recommend you print out the full contents of any response you get from the Stripe API.
Additionally, are you seeing API requests in your Stripe Dashboard?
Specifically, ones that are failing?
If so, please provide the request IDs as text, eg. req_XXXXX
req_sJ9b19ovcnn3L9
then what is the source?
That is something you will need to figure out by debugging your own code