#jesse_p
1 messages · Page 1 of 1 (latest)
Hi @sour patrol - creating a thread for us here
Great!
Yes! That should work, although if you do not want to use the old Payment Intent you can cancel the old one via the API, https://stripe.com/docs/api/payment_intents/cancel. To learn more about Payment Intents, please visit: https://stripe.com/docs/payments/intents
I followed the quick start tutorial for a nextjs project that I'm working on. When the user selects the "pay" button, a new payment intent is created and the payment intent client secret is sent to the front end. Is there a way to check that an existing payment intent already exists based on certain criteria?
Can you elaborate on the last bit of the question please? *Is there a way to check that an existing payment intent already exists based on certain criteria? *
Like if you're looking to get a list of Payment Intents in a specific status you could use the Search Payment Intents API: https://stripe.com/docs/api/payment_intents/search
I'm building a checkout process where a user logs into my application to view their invoices. If they select an invoice and click the "Pay" button, the checkout form gets rendered.
When the checkout form gets rendered, it creates a payment intent.
So if they leave the invoice page and select the invoice again (lets say 10 times), it creates 10 payment intents
So I'm wondering if that's OK, or if when a payment intent gets generated the first time, I should store the paymentintent.clientsecret in my database
Hopefully that makes sense
It does, you would not want to store or log. It's ok to have these Payment Intents but it's a concern to you, you can cancel them via the API.
I'm just not sure how to cancel them if I don't have a client secret
For example, if that user that goes and clicks the "pay" button on one of the invoices, the client secret doesn't get created until they click "pay"
So I wouldn't be able to use the API to delete an old one
Unless I created some kind of cron job
You would cancel hem by passing the Payment Intent id that was created. There is an example request on the API document, https://stripe.com/docs/api/payment_intents/cancel
Are Payment Intent ids not created for these? They'd look something like this: pi_1abc234. These are fine but if you want to cancel them you can.
No, payment intents are being created. In the request object that gets sent to the API, I changed the description to be an invoice number instead of the payment intent id
When I select a payment, I can see the id in the url
Yeah, having 'Incomplete' Payment Intents, are fine. Do you have particular concerns over them?
No concerns
Well, initially I did lol
I think it would be a rare occasion for a user to refresh the page, select the "Pay" button a bunch of times
But if it's OK to have incomplete intents, that is fine with me. Just wanted to make sure I wasn't doing anything wrong.
Thanks for the help
Sure!