#ryan-react-element
1 messages · Page 1 of 1 (latest)
Hey there
The style object is indeed the way to go. But yeah I'm not positive about borders
Give me a min to check
Ok, thanks.
Yeah I don't believe you can set a border inside of Card Element itself. If you want this you would want to use the split Elements and then you can style each separate div itself.
Oh, I'm using the CardElement React component and didn't know that there were more granular ones. Great. I'll check those out. Thanks!
Yep! Take a peek at https://stripe.com/docs/stripe-js/react#available-element-components which has the ones you want to split this up
That's great. But I suspect that this part will no longer work?
// https://stripe.com/docs/payments/save-card-without-authentication?platform=web#add-elements-to-your-page
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: "card",
card: elements.getElement(
CardNumberElement
) as stripeJs.StripeCardNumberElement,
// billing_details: {
// name: cardholderName.value,
// },
});
I used to have it as
card: elements.getElement(
CardElement
) as stripeJs.StripeCardElement
Still works just fine
You just pass one of the split up Elements into createPaymentMethod
And it will grab all the data
Nice. And it looks like there is no PostalCode element? So I need to make one?
ok, thanks for your help!