#akram.alsaidi
1 messages · Page 1 of 1 (latest)
I'll be with you as soon as I can, in the mean time I've created a thread you can put the additional context for your question in
how can make the payment method card is nice ?
I,ve attached style like doc but no there big change
i need like this
Apologies for the delay. Those are two different things you're comparing. The first screenshots shown are working with the Card Element, the last one is our Payment Element instead. What are you trying to accomplish?
with card pleas
Okay, what do you want to do to it? That style object you referenced is the correct way to adjus the styling of the card element.
so the design to become is fine we need to do that by my silf ?
Yes, you will need to match the styling of the card element to the styling of the page where you want to embed it.
ok thank you
how we can use on focus ?
with style ?
var element = elements.create('card', {
style: {
base: {
iconColor: '#c4f0ff',
color: '#fff',
fontWeight: '500',
fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
fontSize: '16px',
fontSmoothing: 'antialiased',
':-webkit-autofill': {
color: '#fce883',
},
'::placeholder': {
color: '#87BBFD',
},
},
invalid: {
iconColor: '#FFC7EE',
color: '#FFC7EE',
},
},
});
Hm, I'm not sure if there's prebuilt functionality for that.
I'm not seeing any Events that the cardElement is expected to emit other than it's on change events. Are you able to set onfocus listeners that trigger when the element is focused? If so, I think you'd be able to update the Element and pass it a new Style object to change its styling when it's focused.
Oh, I see, it uses :focus to indicate onfocus settings.
i am using like this .StripeElement--focus{
color:red;
}
Running some tests, and I'm finding that it works if I use syntax similar to what is seen in the sample code for ::placeholder
I have this:
color: 'red',
}```
which seems to cause the text of the input fields to change to red on focus
There are two different versions of the Card Element, a single element where all fields are included in one element (the approach you seem to be using now), and another where each field is its own element. With the latter you use separate cardNumber, cardCvc, and cardExpiry elements. I believe you only apply separate stylings when using the separate elements.
The Card Element is typically considered a legacy approach at this point, I'll see if we have docs that talk about it, but they may not be around anymore.
what is the best ?
Using the Payment Element is our currently recommended flow.
i can use this one ?