#viviang5
1 messages · Page 1 of 1 (latest)
👋 Happy to help!
When you said "nothing happens", does your code get to execute? Could you put the log at the start end end of the function to check if it got executed?
Alternatively, you could download the sample code here to check the differences: https://stripe.com/docs/payments/quickstart?lang=php
I don't think it executed, I'll check the log. The code that I used looks slightly different than the one you shared, I'll send a screenshot. Would it make a difference?
The payment element
Is there any error in the browser console log?
Where did you create the payment intent in your JS code? Like how is clientSecret created?
I don't see how clientSecret in your code is created. Where is it exactly that your frontend JS makes a backend call to create a payment intent?
the last two images are in the same .php file and the first is in config.php
It should be a POST request like this:
const { clientSecret } = await fetch("/create.php", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ items }),
}).then((r) => r.json());
Okay, I will try that out. I followed the guide I attached in the first message and watched a video on Stripe's YouTube channel that did not have the code you just sent and it worked without it. Do you know why that is? I will try that out and get back to you
It's actually at Step 3 - Create Payment Intent, but the guide omitted the details of how the payment intent should be created
I'd recommend following this guide instead for the complete code: https://stripe.com/docs/payments/quickstart?lang=php
Okay, thank you for that! I will try this one out instead and come back if I still have questions