#Fnky
1 messages ยท Page 1 of 1 (latest)
hello! if you reach out to Stripe Support - https://support.stripe.com/contact, they'll be able to advise you on that!
heya, so you're you're seeing the error in those screenshots now?
one is from production dev tools, another from Sentry
can you paste your code snippet where you're initializing / mounting the element?
import { useElements } from "@stripe/react-stripe-js"
const elements = useElements()
const element = stripeService.stripeElements.get(type)
where type can be
PAYMENT_METHOD_PRZELEWY24: "p24",
PAYMENT_METHOD_IDEAL: "ideal",
PAYMENT_METHOD_BANCONTACT: "bancontact",
PAYMENT_METHOD_EPS: "eps",
PAYMENT_METHOD_GIROPAY: "giropay",
PAYMENT_METHOD_CARD: "card",
this is the function passed when creating element
const handleReady = () => {
const stripePaymentElement = elements?.getElement(element)
stripePaymentElement &&
stripeService.setStripePaymentElement(stripePaymentElement)
paymentStore.setStatus("done")
scrollToElement()
}
like this
React.createElement(element, {
options: { style: stripeFormStyleObject },
onReady: () => onReady(),
onChange: () => onChange(),
})
okay, are you able to identify which specific line is causing that error?
yes, and as per Sentry, it's this one (getElement)
const stripePaymentElement = elements?.getElement(element)
additionally, element renders properly. I can drop loading ( set status on .finally, for example ), but as it then get's passed on to our backed, request fails anyhow.
seems to be an issue with stripes .getElement method, but I can't put my finger on it
started acting funky last Friday. last changes to frontend was 2 weeks prior, with no apparent changes that could trigger this
also, card (credit card) element behaves correctly
just those 3 are wonky
In const element = stripeService.stripeElements.get(type) , what does it return?
It looks like the element isn't a valid value
import {
IdealBankElement,
P24BankElement,
EpsBankElement,
CardElement,
P24BankElementComponent,
IdealBankElementComponent,
EpsBankElementComponent,
CardElementComponent,
} from "@stripe/react-stripe-js"
public stripeElements = new Map<PaymentMethod, StripeElementObject>([
[payments.PAYMENT_METHOD_PRZELEWY24, P24BankElement],
[payments.PAYMENT_METHOD_IDEAL, IdealBankElement],
[payments.PAYMENT_METHOD_EPS, EpsBankElement],
[payments.PAYMENT_METHOD_CARD, CardElement],
])
I'll get back to you, got a pretty long meeting! Thanks!
Yup! I think it will be helpful to log the value of element at the time before const stripePaymentElement = elements?.getElement(element) is called
It's likely that the element is null
@fiery pecan What's the issue?
still the same ๐ I wrote that I'll get back and I'm getting back ๐
Can you summarise the issue?
With no changes to codebase, since last Friday, 3 payment methods ( P24, iDeal, EPS ) started failing ( and blocking our customers from payment via these methods ). Any idea what's up? I'll add details in thread.
this is what happens when I try to mount said elements
again, since Friday, hasn't happened on Thursday or any day before that
(05.05.2023)
What is stripeService.stripeElements.get(type)?
And why are you passing that to elements.create()?
to be honest not sure as to "why", I haven't implemented it.
stripeElements.get(type) is a Map that returns StripeElement based on type ( value from clicked chip component )
said element is then passed to React.createElement to pass onReady & onChange, and override styles
I don't think your stripeElements.get(type) method/fn is returning that you think it is in this instance, hence the error
yeah I'd assume that as well. Curious as to why it has a day before.
Btw, element itself is rendered properly (?)