#ryan-react-element

1 messages · Page 1 of 1 (latest)

south elmBOT
sullen stone
#

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

south elmBOT
analog wave
#

Ok, thanks.

sullen stone
#

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.

analog wave
#

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!

sullen stone
analog wave
#

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
sullen stone
#

Still works just fine

#

You just pass one of the split up Elements into createPaymentMethod

#

And it will grab all the data

analog wave
#

Nice. And it looks like there is no PostalCode element? So I need to make one?

sullen stone
#

That's correct

#

You would collect that in your own form

glacial crescent
#

correct

#

ryan-react-element

analog wave
#

ok, thanks for your help!