#ebellotpu6

1 messages · Page 1 of 1 (latest)

ancient haloBOT
subtle belfry
#

Manage how?

young helm
#

get the message and change it

#

to show to the customer

subtle belfry
#

What function(s) are you using from Stripe.js that returns errors?

young helm
#

i am trying with paymentElement.on('change', (event: any) => {...} but the object event only have this items:
{
collapsed: false
complete: false
elementType: "payment"
empty: false
value: {
type: "card"
}
}

subtle belfry
#

So you want validation errors?

young helm
#

yes

#

i want to get for example incorrect_number, incorrect_cvc, expired_card

#

If I can get the error code, I can manage the message I show to the customer

young helm
#

yes, this is what i am doing

#

but the event object returns:
{
collapsed: false
complete: false
elementType: "payment"
empty: false
value: {
type: "card"
}
}

subtle belfry
#

Ah, my guess is that's not available on the Payment Element

young helm
#

😭

subtle belfry
#

Let me confirm

#

What specifically do you want to manage, btw?

#

Localisation?

young helm
#

the formality

subtle belfry
#

Ok, let me check

young helm
#

any news?

subtle belfry
#

Ok so the change event doesn't include the error hash. But you should still be able to manipulate the DOM nodes as needed:
document.getElementById('Field-expiryError').textContent as an example

young helm
#

this doesn't work because it is inside an iframe...

#

and i can get the document.getElementById('Field-expiryError')

ancient haloBOT
subtle belfry
#

Hmm you should still be able to access those nodes regardless of the iframe

dreamy owl
young helm
#

the change event is only fired when the complete value changes

#

it there an event for paymentElement that fires on input change?

dreamy owl
young helm
#

no one...

dreamy owl
#

What do you mean?

young helm
#

no one does what I need

dreamy owl
#

You want an event to be fired at every keystroke in the Payment Element? Not sure that's possible. Can you clarify why you need this?

young helm
#

exact what you said

young helm
#

how to remove the event listener?

dreamy owl
#

Can you clarify your question? What are you trying to do?

young helm
#

paymentElement.mount('#payment-element');
paymentElement.on('change', (event: any) => {
this.disableSignPayButton = !event.complete;
});

#

i want to disable button if the from is not completed

#

But I have also a custom payment method that are not managed by stripe, so if i change the payment method, i want to remove the onChange listener

opal nebula
#

Hi! I'm taking over my colleague. Please, give me a moment to catch up.

opal nebula
young helm
#

paymentElement.mount('#payment-element');
paymentElement.on('change', (event: any) => {
this.disableSignPayButton = !event.complete;
});
i want to disable button if the from is not completed
But I have also a custom payment method that are not managed by stripe, so if i change the payment method, i want to remove the onChange listener

opal nebula
#

I understand. So you want to know how to remove the event listener? Can you have a condition instead, inside of the handler to not execute the logic when you use the other custom payment method?

young helm
#

the problem is that I am getting error

opal nebula
#

There's no method to remove the listener, I'm afraid.

opal nebula
# young helm

This doesn't look like errors related to event listeners.

#

Could you share more details about the error? When does it occur? Do you see the Payment Element being rendered?

young helm
#

yes, everithing works well despite the errors

opal nebula
#

I think you can ignore it for now, unless there's any customer-facing impact.