#tsahnar-paymentElement

1 messages ยท Page 1 of 1 (latest)

gusty bison
#

Hi there, do you have a page where I can reproduce the problem?

worn crow
#

It is hapenning when we are working locally

#

on the dev enviormant

#

Nothing is loading in the input fields and we cannot type in them

fair flume
#

Hi! Can you share your code?

worn crow
#

yes

#

just a second

#

We have this wrapper that wraps places where we use the form:

#

export const StripeElementsWrapper: FC = ({ children }) => {
const stripePromise = loadStripe(config.stripePublicKey);
return <Elements stripe={stripePromise}>{children}</Elements>;
};

fair flume
#

Where are you passing the clientSecret to the Element?

worn crow
#

No client secret

fair flume
#

As mentioned in the doc I just shared: " If you want to use Payment Element, it is required to pass in the clientSecret."

worn crow
#

It worked without it

#

up until now

#

As you see I cannot even pass a saecret key in options

fair flume
worn crow
#

yes import { Elements } from "@stripe/react-stripe-js";
import { loadStripe } from "@stripe/stripe-js";

#

I should say that this is somwthing that worked - we have not changed anything

#

and in our starging/prod enviorments its working. In our deve enviorment we get the error I send you

fair flume
#

Strange. And this is the error:

Uncaught (in promise) URIError: URI malformed
at decodeURIComponent (<anonymous>)
And you are sure it comes from the Payment Element?

worn crow
#

I think so

#

The fields are not loaded propely and you can see the error is from V3

#

stripe.esm.js

#

error in initStripe method

fair flume
worn crow
#

We already send it there

#

no response

#

yet\

ornate ingot
#

Hey there, taking over from @fair flume

#

Which version of @stripe/react-stripe-js do you have installed?

vestal tideBOT
#

This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact

worn crow
#

Hi! se we use version 1.4.1

zinc zealot
#

Hey. Give me a bit to catch up here

worn crow
#

Ok let me know if you got questions for me

zinc zealot
#

I see. Has someone responded to your support request yet over email?

worn crow
#

They said they are still checking it

#

but no concrete response

zinc zealot
#

Ok. If they are already investigating there, I will let them continue to assist you in that channel

#

They'll give you a concrete response

#

Will be a difficult thing to investigate over Discord

#

As there are many threads

ornate ingot
#

@worn crow Sorry, which version of @stripe/stripe-js?

worn crow
#

1.4.1

#

sec

#

sorry this is the react one

ornate ingot
#

Looks like your types are just out-of-date. So you could silence with // @ts-ignore

worn crow
#

1.16.0

ornate ingot
#

Try updating

worn crow
#

where do I get the client secret? How did it work without it up until now?

ornate ingot
#

Are you just now transitioning to use <PaymentElement />?

worn crow
#

No

#

we have this for the last couple on months

#

it worked without it. We use the client secret when trying to confrim setup intent in the client

ornate ingot
#

I don't know then. But the <Elements> provider requires the clientSecret prop if you're using the <PaymentElement>

worn crow
#

We didnt need it - and in fact this is working on other enviorments (like our prod)

ornate ingot
#

Stripe.js will error without it and the Element won't render

#

But anyway, that error you shared is just your types being out-of-date. So update your packages and it'll have new type defs

worn crow
#

So should I update stripe.js? ot stripe-react js

#

?

ornate ingot
#

Both if you can

worn crow
#

Ok I will try it

vestal tideBOT
#

This thread has been archived. If you need help with anything else please ask in #dev-help or contact Stripe Support: https://support.stripe.com/contact

worn crow
#

Hi again

#

i tried updating but I still get the same result

#

updated both stripe react js and stripe js to latest

slate portal
#

Catching up here @worn crow, give me a moment!

worn crow
#

I want to add that this is something that worked, we even rolled back to a very old branch but still the same behvior

#

in local env, the stripe credit card fields are not loading properly

slate portal
#

I know you are saying it worked before, but Payment Element has always required a client secret in order to render.

worn crow
#

I can send you a link now to a form which does not have the client secret

#

and it works

#

locally it stopped working

#

we use the generated secret when calling confirmCardSetup

slate portal
#

That would be great

worn crow
#

go to the drop down and click add new card

#

This will open our form that uses your elements

#

As you can see everything is working as expected.. in our dev env its not loading properly

slate portal
#

Thanks for providing that and sorry for the delay! Still looking, give me a moment.

worn crow
#

thanks

slate portal
#

Can you provide your account ID?

worn crow
#

where do I get it?

slate portal
worn crow
#

acct_1I2w7nH9XIA4kPmA

#

For the link I send you the account is different

#

because for local dev we got a different account. What I sent you (where it working) its the sandbox

slate portal
#

Alright so from testing it doesn't look like you are using Payment Element in that sandbox

#

Ah actually, I'm not sure that is the correct account for that form. I'm not seeing my test in the account at all.

worn crow
#

yeah as i told you

#

the link I provided is for ouir sandbox

#

where it works

slate portal
#

I ran a test payment on that link that had a working form to take a look at how the payment was created, but it isn't showing in the above account.

worn crow
#

Correct

#

I can send you the account of the form

#

but there we do not have any issue

slate portal
#

Yep sure, that would still be helpful as you are stating the two forms should behave the same way.

worn crow
#

sending now

#

acct_1GmenhDI8A3U6F9i

slate portal
#

Okay thank you. So it looks like you are using Card Element here with a SetupIntent. This is a different integration than Payment Element. Card Element does not require a client secret in order to render like Payment Element does.

worn crow
#

Ok so we are now aligned on this

#

Got any idea whats causing the error we are seeing?

silver hawk
#

๐Ÿ‘‹ Hello! I'm hopping in since @slate portal has to step out

#

You're referring to the URI Malformed error from earlier?

worn crow
#

yes

#

Still same behvior when working on dev enviorment

worn crow
#

?

silver hawk
#

I'm trying to reproduce the same error, but I'm not seeing the same issue - what version of react-stripe-js and stripe-js are you using?

worn crow
#

As I wrote above we used 1.4.1 and 1.16

#

but I updated both to latest and it still happening

silver hawk
#

and what version of react are you using?

worn crow
#

17.0.1

silver hawk
#

I'm still not able to reproduce for some reason - is there anything unique about your dev setup that I may be missing in my reproduction?

worn crow
#

I dont think so...

#

its just stopped working suddenly

#

The error is not clear - do you have any idea where this can come up? The url deformed error

silver hawk
#

I'm not sure why this could be happening at all, and it's tough because I don't see the same thing in my own local integration

#

Is this something you see happen consistently across chrome, firefox, and safari?

worn crow
#

yes

#

Also there was another use case that it happned on our sandbox enviormnt - we cleared the stripe cookies, did restart and it worked

#

So it happned one time not in our local env

silver hawk
#

Just to triple check - when you log/print config.stripePublicKey right before calling loadStripe you get a pk_xxx value, correct?

worn crow
#

yes

zinc raft
#

Thank you for confirming. We are still looking in to what may be causing this error.

worn crow
#

Thanks!

vivid tide
#

hey @worn crow -- how are you accessing this local env? Can you share the URL here (I'm aware it won't work, but would like to see the full URL)

vivid tide
#

Have you been able to narrow this down to a minimal reproduction you can share the complete runnable code for we can inspect?

worn crow
#

I think w found the issue - on our end

#

Thank you for you support

#

took a lot of time to investigate and pin point the exact issue

hoary talon
#

What was the problem?

vivid tide
#

Can you share what that was, exactly?

hoary talon
#

If other people run into something similar it would be helpful for us to know what the fix was. ๐Ÿ™‚

worn crow
#

It was something in our local enviorment

#

we didnt pass some enviorment variables and its messed up our URL

#

explains why it happened only in our local env

vivid tide
#

I'm guessing there was some placeholder or missing component leading to an invalid URL structure?

worn crow
#

yes exactly

#

Thank you for helping with this

vivid tide
#

in dev console you get The attempt to bind "/test%s" in the workspace failed as this URI is malformed.