#dowabes219

1 messages · Page 1 of 1 (latest)

static harnessBOT
chilly grail
#

It sounds like you didn't actually a client secret

#

I see you are fetching the Payment Intent, but you're using clientSecret, which is a variable that has no client secret in it. You would likely need to do something like const elements = stripe.elements({r.data.clientSecret})

neat iris
#

this code from the tutorial
https://youtu.be/tCSbCk5j3Tk?t=698

In this episode, you'll learn how to accept a one-time payment with a custom form using Python on the server and the Stripe Payment Element on the client. The Payment Element enables you to collect several different payment method types from cards and bank accounts to wallets and buy-now-pay-later payment methods.

Presenter

CJ Avilla - De...

▶ Play video
neat iris
chilly grail
#

Or use const { clientSecret } = await response.json();

neat iris
#

but why it works in the video?

chilly grail
#

That video might be outdated

neat iris
chilly grail
#

Yup

neat iris
#

could you provide me full code?

chilly grail
#

That's an endpoint on your server

neat iris
#

I am newbie in JS

chilly grail
#

The example I provided above has the full code

#

You should be able to literally copy and paste almost the entire thing to get it running

neat iris
#
    const {publishableKey} = await fetch('/config').then(r => r.json())
    const stripe = Stripe(publishableKey)

    // const {clientSecret} = await fetch('/create-payment-intent', {
    //     method: 'POST',
    //     headers: {
    //         'Content-Type': 'application/json'
    //     }
    // }).then(r => r.json())
    const { clientSecret } = await response.json();
    const elements = stripe.elements({clientSecret})
    const paymentElement = elements.create('payment')
    paymentElement.mount('#payment-element')
})```
#

what is response?

chilly grail
#

I don't understand the question. What do you mean?

neat iris
chilly grail
#

THere's on in the page I linked you to

neat iris
chilly grail
#

What does your code look like after copy/pasting the examples?

neat iris