#francois_unexpected

1 messages · Page 1 of 1 (latest)

lapis cometBOT
#

👋 Welcome to your new thread!

⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225367714412105749

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

wet sirenBOT
white cove
#

hi there!

#

can you share the exact code you are using? and a PaymentIntent ID (pi_xxx) with this issue?

#

also do you see any error messages in the browser console?

sly ocean
#

nothing at all

#

here's the code:
const paymentResult = await stripe.confirmCardPayment(
response.clientSecret,
confirmPaymentPayload,
);

  if (paymentResult.error) {
     // handle error
  }

  if (paymentResult?.paymentIntent?.status === 'succeeded') {
    // handle success
  }
#

all of this is wrapped in a try / catch block with a finally statement, but we never get passed the await call

#

example of a failing payment id: pi_3P1lr2FpAKNo2Ml21mg0RUfq

white cove
#

does this happen all the time or only sometimes?

sly ocean
#

all the time on that specific site where we have the issue. never on other sites

#

and all sites are using the same code above

white cove
#

are all the sites using the same Stripe API keys?

sly ocean
#

yes, but payments are made for different stripe connect accounts

#

all under our own stripe account

white cove
#

the PaymentIntent ID you should shared is not using Stripe Connect.

sly ocean
#

I'm not sure I follow. but in any case, I don't think it's related to the stripe connect, cause we've hooked up the site that has the issue with another customer integration and we have the same failure. if we use that same customer integration on another site, it's working

#

so there's something on that customer site that must be causing that unexpected behaviour when we call stripe.confirmCardPayment, but we can't figure out why. we're doing things the same way

white cove
#
const paymentResult = await stripe.confirmCardPayment(
        response.clientSecret,
        confirmPaymentPayload,
);

can you log what's the value of response.clientSecret and confirmPaymentPayload?

sly ocean
#

response.clientSecret is a string, and it's the secret for creating the paymentIntent which we get from our back end

#

give me a mn to log the confirmPaymentPayload

white cove
#

response.clientSecret is a string, and it's the secret for creating the paymentIntent which we get from our back end
can you share the exact string you are passing?

sly ocean
#

but basically it's like this
const confirmPaymentPayload = {
payment_method: {
card: elements.getElement(CardElement) as StripeCardElement,
billing_details: billingDetails,
metadata: {
subjectType: response.subjectType,
},
},
};

#

CardElement being the element from the stripe library

white cove
#

or do you have a link where I can reproduce the issue?

sly ocean
#

I can but it's gonna be on our production payment

#

it doesn't want to log to the console, but the structure of the object when debugging is the same as it is on the other websites which are working

#

and client secret for this last attempt is "pi_3P1mVHFpAKNo2Ml20n1bI2nP_secret_QtZYfLIzZX3qusDcX56s7uEHz"

white cove
#

sorry for the delay, having a look

sly ocean
#

no worries

plush lily
#

can you get us that repro page plus instructions?

sly ocean
#

ok hold on

#

on our staging env

#

sorry

#

this is production ☝️

plush lily
#

total guess but maybe you have some bad polyfills, I've seen that break things

sly ocean
#

that would cause the promise to never resolve ?

plush lily
#

sure, sometimes sites/libraries have broken implementations of window.Promise because of bad polyfills

sly ocean
#

but when I stepped into the code, I didn't see that I was going through a weird polyfill

#

yeah I've seen what they have in their. they also have weird scroller logic that breaks the debugger sometime

#

I was wondering if there was something else though, maybe this happened somehow previously to have that promise hang and never resolve

plush lily
#

FWIW a breakpoint on handlePaymentSubmit's first line in BookingForm.js doesn't get hit for me

#

maybe that's just a sourcemap issue but maybe it means your code is doing something wrong before that point

sly ocean
#

go to checkoutPage.tsx

#

you're not in the right file

#

we'd notice if that code was broken 🙂 it's running for undred of websites, processing quite a few bookings & payments

plush lily
#

I see. I can't set breakpoints there anyway probably due to minification or whatever

sly ocean
#

yeah

plush lily
#

anyway I'll look some more but now I would say you have some broken global object that is breaking something that our library uses so try stripping down the page and removing other libraries/frameworks etc

sly ocean
#

ok thanks, we'll look into this

#

the weird thing is that we use promises in our code as well obviously, and we're not seeing that behaviour of hanging promises anywhere else

#

it's just on this function call

plush lily
#

it's just a guess, I could be wrong

#

also did you change something on the site? I was trying to debug some more but now the CardElement is not mounted at all.

sly ocean
#

No, nothing

plush lily
#

ah nvm, it was a network issue on my end

sly ocean
#

They set CSP to allow for stripe, I don’t think we’re usually required to do anything else

#

But since the card element loads I didn’t think it could be something like that

plush lily
#

it was on my side, don't worry about it

sly ocean
#

Are you able to step in the confirmCardPayment function ? Cause we couldn’t do that

#

Maybe you can see something in there ?

plush lily
#

not really since it's all obfuscated

#

besides breakpoints seem to barely work on that page for some reason, they refuse to get set

sly ocean
#

Ok

plush lily
#

I intentionally blocked some of the suspicious libraries from loading in case that helped but not really

sly ocean
#

Is there some info I can pass to link to what you’ve been searching for ?

#

Yeah and we’re still not seeing the call made by the stripe lib to confirm the payment, which we see on other websites

plush lily
sly ocean
#

Alright. Thx