#ebellotpu6
1 messages · Page 1 of 1 (latest)
Manage how?
What function(s) are you using from Stripe.js that returns errors?
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"
}
}
So you want validation errors?
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
yes, this is what i am doing
but the event object returns:
{
collapsed: false
complete: false
elementType: "payment"
empty: false
value: {
type: "card"
}
}
Ah, my guess is that's not available on the Payment Element
ðŸ˜
the formality
Ok, let me check
any news?
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
this doesn't work because it is inside an iframe...
and i can get the document.getElementById('Field-expiryError')
Hmm you should still be able to access those nodes regardless of the iframe
There's a Stackoverflow explaining how to get DOM elements within an iframe: https://stackoverflow.com/questions/1088544/get-element-from-within-an-iframe
the change event is only fired when the complete value changes
it there an event for paymentElement that fires on input change?
no one...
What do you mean?
no one does what I need
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?
exact what you said
how to remove the event listener?
Can you clarify your question? What are you trying to do?
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
Hi! I'm taking over my colleague. Please, give me a moment to catch up.
I see. So what's the challenge you're facing?
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
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?
There's no method to remove the listener, I'm afraid.
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?
yes, everithing works well despite the errors
I think you can ignore it for now, unless there's any customer-facing impact.