#jose-cardelement-react
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- joseamica, 1 hour ago, 25 messages
Hi 👋
Do you have other elements loaded on the page?
<Flex direction="col" space="sm" className="p-2 bg-blue-200 rounded-xl">
<Flex
direction="col"
space="sm"
className={clsx('p-2 border rounded-xl bg-white', {
'border-borders-selected border': isCardNumberFocused,
})}
>
<H4 variant={isCardNumberFocused ? 'primary' : 'disabled'}>Número de tarjeta</H4>
<Flex className="box-border w-full " align="center">
<CardNumberElement
onFocus={() => setIsCardNumberFocused(true)}
onBlur={() => setIsCardNumberFocused(false)}
className={`w-full `}
options={cardElementOptions}
/>
</Flex>
</Flex>
<Flex justify="between" space="sm">
<Flex
direction="col"
space="sm"
className={clsx('p-2 border rounded-xl w-full bg-white', {
'border-borders-selected border': isCardExpiryFocused,
})}
>
<H4 variant={isCardExpiryFocused ? 'primary' : 'disabled'}>Fecha de caducidad</H4>
<CardExpiryElement
onFocus={() => setIsCardExpiryFocused(true)}
onBlur={() => setIsCardExpiryFocused(false)}
options={cardCvcAndExpireElementOptions}
/>
</Flex>
<Flex
direction="col"
space="sm"
className={clsx('p-2 border rounded-xl w-full bg-white', {
'bo border': isCardCvcFocused,
})}
>
<H4 variant={isCardCvcFocused ? 'primary' : 'disabled'}>CVC</H4>
<CardCvcElement
onFocus={() => setIsCardCvcFocused(true)}
onBlur={() => setIsCardCvcFocused(false)}
options={cardCvcAndExpireElementOptions}
/>
</Flex>
</Flex>
</Flex>
CardNumberElement,CardExpiryElement,CardCvcElement
Okay so you are using the split card element?
Yes, im not using PaymentElement
In that case you want to use confirmCardPayment()
My colleague has a nice demo version of this (written in vanilla JS) here: https://4242.io/test/card-element-split/
IF you scroll to the bottom you can see all the JS they are using
Sorry im not very experienced with javascript, thats why im struggling, i am a react developer
No worries
But in this case you are using a method that only accepts the Payment Element ( .confirmPayment) . Because you are using the Card Element you need to change how you are confirming the Payment Intent
But there is not guide?
The Card Element is quite old and outdated so our current docs do not show how to use it. But the site I shared with you has the javascript and clearly shows you what methods you need to call and how.
or the paymentElement can be fully customizable?
In your case you just need to change your confirm function to this
const {error, paymentIntent} = await stripe.confirmCardPayment(clientSecret, {
payment_method: {
card: cardNumberElement,
}
});
You can review details of the Payment Element and the available customization options in our docs: https://stripe.com/docs/payments/payment-element
one question
why each time i load the paymentElement, i get a incomplete payment on my stripe dashboard
Likely it is because you built your integration to create a new Payment Intent every time someone visits your Payment Element page. It remains incomplete unless you confirm it with the Payment Element
is a way to prevent this?
We have a revised flow where you collect payment method information first and then create the Payment Intent: https://stripe.com/docs/payments/accept-a-payment-deferred
What i need to do, is to specify a tip, so the total is going to change
That would avoid this
jose-cardelement-react
this guide is wrong
Says i need to pass on confirmPayment the clientSecret, but it doesnt accept that
that is about using PaymentElement though which you are not using right?
I am using that
const { error } = await stripe.confirmPayment({
elements,
clientSecret,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
})
Sorry, that doesn't change anything. You can not call confirmPayment() if you are not using PaymentElement.
The guide you shared uses PaymentElement. If you don't, you can't use that guide.
That's what my colleague explained earlier
Im using paymentelement
[9:47 AM]Snufkin_stripe: Okay so you are using the split card element?
[9:48 AM]JAC[Dev]: Yes, im not using PaymentElement```
you literally said the opposite earlier, did you change your mind or are you just trying a brand new integration? Just want to make sure I understand what's going on
i change to paymentelement
Okay, so what's the real issue? For now you said "the guide is wrong" with no real info.
ok i figure it out, but with this configuration:
https://stripe.com/docs/payments/accept-a-payment-deferred?platform=web&type=payment
i still can store credit cards info for future payments?
yes