#ricky-element-react
1 messages · Page 1 of 1 (latest)
const paymentElement = elements.getElement(PaymentElement);
if (paymentElement) {
const { paymentMethod: payment, error } =
await stripe.createPaymentMethod({
type: 'card',
card: PaymentElement,
});
you seem to be mixing up ~everything
Payment Element is a completely different product/UI
Thank you @gloomy pewter
From what I read I need to import this
PaymentElement
but its not working for me.
Am I going about this correctly or should I keep CardElement
are you trying to use Elements? Do something else?
Step 1 is understand what the end goal is
The only goal is to separate the checkout into different fields
why?
We are hitting auto complete issues having the one long input and would like to separate into different input fields
I think that's a mistake honestly.
My advice is to purely use the PaymentElement, it does everything for you
Because the ZIP only appears once a card # is detected, auto complete won't fill in the ZIP
That is what I would like to use and move away from CardElement
Just having trouble swapping it out to start using PaymentElement
I understand but you're really trying to go too fast, change one line of code, that won't work really
so I'm trying to understand your end goal, because if you are re-designing this, maybe you'd be better off moving to PaymentElement entirely
I'll take it slower, good note - Yes we want to ditch CardElement and go to PE
okay
so replacing with PE will require changes to your integration since you don't "Create a PaymentMethod" anymore, you confirm a PaymentIntent or SetupIntent
so it won't be a one line change
Separately, with that out of the way: we do support "split fields" on the card element
you basically have to create a card number, expiry and cvc element separately
trying to find docs
Thank you, I can give that a go - I didn't know the CardElement supported that
yes we don't document this in details but https://stripe.com/docs/stripe-js/react#available-element-components covers all the "UI elements" we support
still trying to find a concrete example
it's not react but it should help
The github is a 404 but looking at the docs link
thank you I'll check this out!