#balconytom-payment element

1 messages ยท Page 1 of 1 (latest)

hardy breach
#

๐Ÿ‘‹ happy to help

#

anything in particular?

prisma prairie
#
      clientSecret: clientSecret,
      appearance: {/*...*/},
      loader: 'always',
    };

    const elements = stripe.elements(options);
    const paymentElement = elements.create('payment');
    paymentElement.mount('#payment-element');
    paymentElement.on('change', (event) => {
      //do sth
      console.log("changed");
      debugger;
    });```
#

I have this simple piece of code, however when I put the debugger in the element doesn't render

hardy breach
#

you mean when you add the debugger keyword in the 'change' event listener?

prisma prairie
#

yep

hardy breach
#

do you have any errors in your console at that time?

prisma prairie
#

nope

hardy breach
#

I think what's happening is that the debugger is pausing the render of the payment element if you have your console open

#

first try closing your devtools but keep the debugger

#

if that works, this means that you just need to press the play button to skip the debugging at that stage

#

until the element is loaded

#

or better, you could open the devtools after the page/the payment element has loaded

prisma prairie
#

ok, that works, thx. It would not load after the first play when the devtools were open on the initial load

hardy breach
#

you would have to press play multiple times I guess

#

the idea is that when you put a debugger, this command would stop the browser from executing what's next on the queue, and each time the "change" event fires you are asking the browser to halt

prisma prairie
#

I get the idea, it's that on the first load the debugger efectively stops the render, and even after pressing play it doesn't go on with the redner, just hangs in loading state, which was surprising

hardy breach
#

it might be triggered multiple times

#

so you might need to press the play button multiple times

prisma prairie
#

it's just once and the play button is gone afterwards

#

but nvm, got the workaround working so I can play now ๐Ÿ™‚

hardy breach
#

I'm glad I could help. let me know if you need any more help