#Schezwann
1 messages · Page 1 of 1 (latest)
Hi 👋 I think you're looking for the readOnly value that can be set when updating the Payment Element:
https://stripe.com/docs/js/elements_object/update_payment_element#payment_element_update-options-readOnly
but please let me know if that doesn't accomplish what you're trying to.
the readOnly option doesn't change the Payment Element's visual appearance as it does not apply the disabled attribute
Oh, if you're more interested in changing the appearance of the Payment Element, then I think you'll want to leverage the Elements Appearance API:
https://stripe.com/docs/elements/appearance-api?platform=web
I've already read those pages but I still don't see how to set the inputs in a disabled state
I don't think you'll set disabled. Instead you set the Payment Element to read only and then use the Appearance API to change the appearance of the element to match the appearance of your disabled fields.
But the inputs already have a dedicated :disabled style
can't I update the inputs classes either ?
I'm not sure I understand what you're referring to, can you elaborate or show me?
If i manually add a disabled attribut to the card number input via my browser devtools I can see that the CSS have a custom :disabled state that does exactly what I want to do
This style seems to also be accessible via a class
Do I really need to change the appearance of the whole element when I could just disabled the input or add the 'p-Input--disabled' class to it ?
Can you add disabled to the Element? What happens when you try to do so?
According to your documentation the disabled option isn't available for the Payment Element
So you can't set it directly?
I get the following error when trying to set the disabled option on a Payment Element
paymentElement.update({ disabled: true });
Unrecognized payment.update() parameter: disabled is not a recognized parameter. This may cause issues with your integration in the future.
Gotcha, so sounds like we're back to setting readOnly and using the Appearance API to change the appearance of the Element.