#left_paymentlink-time
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1504915202301366353
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
left_paymentlink-time
@slow topaz This is not simple. "Expiring" after 5 minutes is easy with PaymentLinks or Checkout Session but not the "if they are already paying"
that one i have resolved by looking at payment intent, if it exists, assume in-payment state
currently (and almost last i believe) issue is after user payment failure, server will receive callback and expire checkout link
however, on the UI side, it stays at the payment selection page, and any interaction will go to "You’re all done here" page without redirect
yeah the PI existing is a side thing, it's not guaranteed
they could be in the middle of entering payment details and not have confirmed yet
that one is negligible for us as everyone rushed in to make payment on the ticket sales time, average payment time is ~1.5 min
but UX after I modified stripe checkout behaviors leads to inconsistent state
Hello! I'm taking over for koopajah who has to step away 🙂
I understand that you're trying to build an integration that times out after 5 minutes unless the user is actively filling out payment details? And you're experimenting with Payment Links versus Checkout? Are you using hosted / embedded Checkout or Elements with Checkout Sessions?
As my colleague said, this is a tricky problem but I'm happy to brainstorm ideas.
Can you also describe more what you mean by an "inconsistent state"?
this is a hosted checkout, we redirect users to stripe checkout URL
sorry it wasn't clear / mixed up words, I'm using checkout API for the whole time
and for inconsistent state, it's where I expires the checkout while user being redirected or still in the checkout payment selection page
edit: user aren't being redirected back to our website, or stuck at "You're all done here" page without button to back or exit
I see! So you're creating a CheckoutSession and setting expires_at? https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-expires_at
yes i did use it, however the minimum value is 30 min
what I did is 5 min after checkout created, it will query the status:
- if has PI - wait another 4 minute to expires it (via /expire API)
- if has no PI, expires it
Okay. Then you're saying when the user pays, they're not being redirected to the success_url or cancel_url?
when it timeout or payment error, it will not redirect properly
in addition to expires, I combined with webhook, to listen for payment_intent.canceled and payment_intent.payment_failed
immediately after will expires it too
Meaning after you call the /expire API, you want the Checkout Session to redirect the user to your website?
yes, correct
Stripe's hosted checkout page will only redirect on success or cancel, not on expiry. And since the user has left your website, there's no way for you to redirect them on behalf of Stripe. So I'm not sure this solution is viable ☹️
what about embedded solution? any demos i can try with?
I believe the embedded checkout form will display an error message if the Checkout Session expires so that might be a better option because the user won't be able to continue payment but will still be on your website. Then, you can redirect them however you wish.
Unfortautnely, I don't think there are any demos that show this. But our guide explains how to get started with embedded checkout: https://docs.stripe.com/checkout/embedded/quickstart
i will look into it and see what can be done, thank you
Happy to help, good luck!