#viviang5

1 messages · Page 1 of 1 (latest)

eternal crescentBOT
drifting island
#

👋 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?

warm umbra
#

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

drifting island
#

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?

warm umbra
#

I am logging errors in a log file since I am testing in through the mobile app.

drifting island
#

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?

warm umbra
#

the last two images are in the same .php file and the first is in config.php

drifting island
#

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());
warm umbra
#

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

drifting island
#

It's actually at Step 3 - Create Payment Intent, but the guide omitted the details of how the payment intent should be created

warm umbra
#

Okay, thank you for that! I will try this one out instead and come back if I still have questions