#zelda.zonk
1 messages · Page 1 of 1 (latest)
Hi there!
Hi
for instance user goes to checkout, and pays but closes window before return_url extecuted
That's a common issue, that's why we strongly recommend to not do that.
Instead, to fulfill orders, use webhook events.
how can i check if payment_intent is used and or invalid?
Not sure what you mean by "invalid". If the status issucceeded, then the funds have moved to your Stripe account.
i am using webhoook to create order, but i need to know if user comes back to checkout before webhook is received if the payment_intent i have for them is ok to use
does that make sense?
in the use case they close window or go back before return_url. user could then come back to site *before webhook recieved) with full cart and try to checkout again, i need to check whether i need to create a new payment_intent for them or use existing one, in this use case i would recreate. but how do i determine this?
is there some kind of method or property on the payment_intent i can get to see if i can use it? https://stripe.com/docs/api/payment_intents/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i am using webhoook to create order, but i need to know if user comes back to checkout before webhook is received if the payment_intent i have for them is ok to use
Waht do you mean by "if the payment_intent i have for them is ok to use". You can check the status of the PaymentIntent on your page directly, to see if it'ssucceededor not.
How are you accepting payments? Checkout Session, Payment Element, something else?
payment element
you cant use the same paymentIntent 2 times correct for successful checkout? that what i mean by used,
and i need to check server side
payment element
Then in your return url you will get some additional query parameters added, that you can use to check the PaymentIntent status: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements#web-submit-payment
as i said this in the use case they dont get to reutrn_url, they close the page before that
Yes but if you are using webhook events, then there's no issue in that case, no?
as i said earlier, this in before the webhook is recieved
I'm sorry I'm really confused. Can you explain exactly, step by step, what is the issue you are trying to solve exactly?
ill just check the PaymentIntent status
I don't understand sorry. In general here's how it works:
- The customer buys something and is redirected to the return_url
- If the customer close their page just before the redirect, then it's okay. Your server will receive the payment_intent.succeeded event, and your can process the order here.
yes but what if customer comes back to checkout before webhook recieved then what>
and the closed window before return_url also
Again I don't understand, what's the issue?
You only process the order in the webhook endpoint. And on the return URL you display whatever information you want, like "order completed".
sry i meant the following "user closes window before return_url then comes back to checkout B4 webhook recieved" then ?
do you unserstand my use case?
understand
again this has nothing to do with processing order i am doing that on webhook, this is about paymentIntent
I'm sorry you still haven't explained to me what exactly is the issue. Can you give me a concrete example?
If you want me to help, please give me a conrete example of your issue. For example something like:
- user buys
- use close the windows before the redirect_url
- use reopen the redirect_url
- ???
- then
payment_intent.succeededis send to my endpoint
- user buys
- user close the windows before the redirect_url
- user comes back to site and head to checkout again before webhook is recieved.
- user cant checkout as paymentIntent has already been used in a successful payment
user comes back to site and head to checkout again before webhook is recieved.
Can you clarify what that means? The use re-enters all their payment method detail in the Payment Element and submits the form?
What you are trying to do is avoid duplicate payments?
yes the refill payment form. not not avoiding duplicate payments, this is a use case for delayed webhook and reusing same paymentIntent from a successful checkout.
all i need is a way to retrieve paymentIntent and check is i can use it again that is all
If you reuse the same PaymentIntent, then just check its status. If it's succeeded then it means the user already paid.
thank you thats what i was after.