#estani.p - Element Destroyed

1 messages · Page 1 of 1 (latest)

scarlet nova
#

Are those both from the same error?

#

Can you tell me a bit more about where you are seeing each of those errors?

lilac willow
#

The Payment Element is not rendering and in console I get this errors

#

The code back and front it's same as you explain in Custom payment floe

#

I'm receiving from back the client secret OK

scarlet nova
#

Interesting, my example that uses that code is currently working. Can you send me the .js file that you have for this at the moment?

lilac willow
#

I send screenshots with the code

scarlet nova
#

Just getting to look at this. What line of code is that error coming from?

lilac willow
#

I dont i cant see it, this is the error in console

scarlet nova
#

Can I see what the options object looks like when you pass it in?

#

Actually never mind. Looking to see if I can find the GET call that you originally posted

lilac willow
#

const appearance = {
theme: 'flat'
}
const options = {
appearance,
clientSecret
}

trail sapphire
#

Hi 👋 I'm taking over for @scarlet nova.

lilac willow
#

HI!

trail sapphire
#

This might be a bit of a long shot but I'm curious if the <Collapse> element you have are wrapping the <StripeCheckoutForm> in may be causing an issue. Could you try removing it and seeing if the error persists?

lilac willow
#

Ok, i tried it

#

ok I'll try

lilac willow
#

is not working, i just get only the button of the form, not the PaymentElement

trail sapphire
#

Okay so the next thing I would focus on is this failing request you're pointing out.

#

The problem is that the publishable key doesn't match the payment intent data.

#

Are you making sure that the publishable_key on your front_end corresponds to the same account as the secret key in you server code?

lilac willow
#

I'm going to check it out

#

FRONT
const stripePromise = loadStripe(STRIPE_SECRET_KEY)

BACK
const stripe = require('stripe')(STRIPE_SECRET_KEY)

#

i check it and it the same KEY

trail sapphire
#

You should never expose your secret key to the front end.

#

We separate secret and publishable keys explicitly for that reason

#

However The request you shared with @scarlet nova earlier had a Publishable Key in it.

#

If that is the key you are using on the back-end, that won't work either.

#

You shared this publishable key: pk_test_vbBRAl4tFiADk0owxxpgH3xA00HbnS0luE

#

This is what is being used in your front-end that is not being matched with a corresponding SECRET KEY on your back-end

lilac willow
#

OK, now i have the same key in back and front

trail sapphire
#

The SECRET KEY for this account would start sk_test_XXXXX

#

Dont ever share your secret key. here

#

This is a public forum

lilac willow
#

Ok

trail sapphire
#

Even a test key can be used to cause havoc by malicious actors.

lilac willow
trail sapphire
#

Okay so my first step, if I were you, would be to verify both Publishable and Secret keys in your dashboard. Then make sure the right one is loaded into each environment:
PUBLISHABLE_KEY (pk_test_xxxx) => Front End
SECRET_KEY(sk_test_xxxx) => Back End

lilac willow
#

The key is the same but back start with sk, and front with pk?

#

ok

trail sapphire
#

The entire text strings are completely different