#alex24-paymentelement-error

1 messages · Page 1 of 1 (latest)

void marten
#

This error usually means that you haven't initialized/mounted a PaymentElement yet. Have you?

kindred gust
#

I have

#

sorry i was helping him

void marten
#

all good, no rush

kindred gust
#

The card elements are mounted on the page

void marten
#

Is there a page I can load to reproduce?

#

Are you using anything fancy like Angular or Vue.js and such

kindred gust
#

unfortuneately its all local docker at the moment

#

we use vue but im doing this in vanilla js and php

#

i have the elements mounted and they work

void marten
#

any chance you can quickly repro this on jsbin or jsfiddle?

kindred gust
#

sure

#

hang tight

void marten
#

you should be able to hardcode the pub key + client_secret

void marten
#

@kindred gust any luck?

kindred gust
void marten
#

Okay so you don't use PaymentElement at all though

#

you explicitly use the old card element, split in sub-fields

#

so you want confirmCardSetup() not confirmSetup()

kindred gust
#

so i copied some of this from a previous project where I was doing card payments

#

are you saying that the api is updated now?

void marten
#

so yes, you're using the old approach. Works totally fine, but the code is different

kindred gust
#

ok

#

so instead of the elements i need to pass the client secret to that?

#

how would i have found that if I didn't reach out to you?

#

nm the link lol

void marten
#

the link is the blog post, all our docs have been updated to use the new flow already

kindred gust
#

ok

void marten
#

it's because you copy-pasted parts of an old project that you hit this bug

kindred gust
#

so im still integrating this, should i switch to that in this project?

#

Since its new?

void marten
#

yes absolutely

kindred gust
#

The other project is old, but it's active

#

so i probably need to revisit it as well then

void marten
#

it will make your life so much easier because it can handle any payment method over time

kindred gust
#

the other project does payments with google and apple pay too

#

so i assumed it would just drop in

#

well that's awesome.

#

Thank you so much. Big stripe fan.

#

Wish I could get access to the corporate card you guys are launching 🙂

#

thanks again for your help man, struggled with this for 2 days

void marten
#

I still think we could improve that error message so I'll flag

kindred gust
#

ok yea

void marten
#

of course, sorry for making you do an entire example I should have double checked that you understood my question :p

kindred gust
#

no worries

#

im more of a php dev

#

but they have us do everything here so i struggle sometimes with the front end stuff

#

thanks so much