#zelda.zonk

1 messages · Page 1 of 1 (latest)

median fossilBOT
green crypt
#

Hi there!

cursive matrix
#

Hi

green crypt
#

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 is succeeded, then the funds have moved to your Stripe account.

cursive matrix
#

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?

green crypt
#

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's succeeded or not.

#

How are you accepting payments? Checkout Session, Payment Element, something else?

cursive matrix
#

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

green crypt
cursive matrix
#

as i said this in the use case they dont get to reutrn_url, they close the page before that

green crypt
#

Yes but if you are using webhook events, then there's no issue in that case, no?

cursive matrix
#

as i said earlier, this in before the webhook is recieved

green crypt
#

I'm sorry I'm really confused. Can you explain exactly, step by step, what is the issue you are trying to solve exactly?

cursive matrix
#

ill just check the PaymentIntent status

green crypt
#

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.
cursive matrix
#

yes but what if customer comes back to checkout before webhook recieved then what>

#

and the closed window before return_url also

green crypt
#

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".

cursive matrix
#

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

green crypt
#

I'm sorry you still haven't explained to me what exactly is the issue. Can you give me a concrete example?

cursive matrix
#

nvm, i have already

#

ill just look at paymentIntent staus

green crypt
#

If you want me to help, please give me a conrete example of your issue. For example something like:

  1. user buys
  2. use close the windows before the redirect_url
  3. use reopen the redirect_url
  4. ???
  5. then payment_intent.succeeded is send to my endpoint
cursive matrix
#
  1. user buys
#
  1. user close the windows before the redirect_url
#
  1. user comes back to site and head to checkout again before webhook is recieved.
#
  1. user cant checkout as paymentIntent has already been used in a successful payment
green crypt
#

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?

cursive matrix
#

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

green crypt
#

If you reuse the same PaymentIntent, then just check its status. If it's succeeded then it means the user already paid.

cursive matrix
#

thank you thats what i was after.