#Dilz-PI
1 messages · Page 1 of 1 (latest)
Hi! If you are using Payment Elements, then you need a client secret to create the Element in the first place.
So like you said, you first create a PaymentIntent on the backend, and then create the Element on the frontend.
It means that you will get some PaymentIntent that are never completed, but that's expected. If needed, you can cancel the PaymentIntent after some delay https://stripe.com/docs/api/payment_intents/cancel
Thanks, that's exactly what I thought. it's a pain as my customer is complaining that the system isn't working as there are a few unfulfilled payment intents, and it doesn't matter how much I explain it to her that that's the way it is, she won't accept it. Is there anyway to automatically cancel a paymentIntent after a set time when the paymentIntent is first created?
From looking at the docs, this doesn't seem possible.
Hey! Taking over
Is there anyway to automatically cancel a paymentIntent after a set time when the paymentIntent is first created?
There's isn't, no
Is there a specific requirement to use the Payment Element? The client_secret is only a prerequisite with that Element
I was following the recommended option from Stripe for implementing taking card payments. All I want to be able to do is have a payment form on my simple checkout page which collects payment details from someone and ideally only creates a payment in Stripe when someone submits the form
Got it. The Payment Element does require a client_secret upfront, mostly as this is used to determine what Payment Methods are available on it (and to show in the UI)
If you're only using card payments, then you can use the old CardElement still which doesn't have that requirement
Ah, ok, so it's still ok to use cardelement? I did quite like the option of having google/apple pay though!
Yep, it is! It's just not the default/recommended integration path now we support more localised payment methods
You can still use Apple/Google Pay but it would be integrated separately: https://stripe.com/docs/stripe-js/elements/payment-request-button
ah, ok, this may be the way to go then as I can't get my client to understand that there will be some incomplete payment intents and it's driving me mad! thanks
Yeah so I guess with CardElement you'd create the PI in your form submission
And then do confirmation with confirmCardPayment passing the Elements instance and the client_secret
cheers for the info, I'll see how I get on
Np!