#Jo-Ld - Payment Element Styling

1 messages · Page 1 of 1 (latest)

hollow onyx
#

Are you using any themes, custom configuration, or the Appearance API?

elder verge
#

No to all 3. Made it as simple as possible.

//Parent
<Elements stripe={stripePromise} options={{ clientSecret: stripePaymentIntent?.clientSecret }}>
<Outlet context={stripePaymentIntent} />
</Elements>

//Form

        <form>
            <PaymentElement />
        </form>
hollow onyx
#
  1. I would recommend trying out the Appearance API to enforce a universal style, sometimes Chrome can get weird.
  2. I'll check for any angry messages
elder verge
#

You mean just to do this?
options={{
clientSecret: stripePaymentIntent?.clientSecret,
appearance: {
theme: 'stripe',
},
}}

hollow onyx
#

Or you could get more customizable if you wanted. we do have a few different pre-built themes

elder verge
#

But I can't set the height can I?

#

I added this in, to log whats happening.

   <PaymentElement
                onReady={(x) => {
                    const y = x as unknown as IStripeDev;
                    console.log(y._parent.clientHeight);
                    setTimeout(() => {
                        console.log(y._parent.clientHeight);
                    }, 100);
                }}
            />

Which gives this output as I click in and out of the page.

instrument.ts:130 2
instrument.ts:130 228
instrument.ts:130 Unmounting component
instrument.ts:130 2
instrument.ts:130 2
instrument.ts:130 Unmounting component
instrument.ts:130 2
instrument.ts:130 228
instrument.ts:130 Unmounting component
instrument.ts:130 2
instrument.ts:130 2
instrument.ts:130 Unmounting component
instrument.ts:130 2
instrument.ts:130 228
instrument.ts:130 Unmounting component
instrument.ts:130 2
instrument.ts:130 228

In looks like after onReady something in the Stripe library resizes the iFrame? But as you can see, it occasionally doesn't work.

#

So the 2nd and 4th ones stayed at 2px. The rest resized to 228

hollow onyx
#

🤔

#

Yeah I do see what you mean

hollow onyx
#

I'm still checking on this FY

elder verge
#

Ok thanks.

hollow onyx
#

Oh great, quick quesiton

#

Are you using just Stripe.js or react-stripe-js?

hollow onyx
#

Hi @elder verge ? Can we get some more information from you?

#

In doing some digging there have been some previous issues with Firefox resulted in similar issues with iFrames

#

In this case I would like to know:

  • Your version of Chrome as well as your OS and version
  • A simple example so we can try to reproduce the error on our end
  • If it's possible, a dump of the Performance tab on your browser as the element renders and the bug occurs.
#

If you could provide some or all of that information it would really help us track down where the error is occurring.

elder verge
#

Thanks. We've done it in multiple versions of Chrome on MacOS & Windows 11. I can send over the performance tab. Can I email it to you? I'd rather not share on here.

hollow onyx
#

And if you could include which versions of Chrome you tested with that would be helpful