#Sadness ;'(
1 messages ยท Page 1 of 1 (latest)
Threads where i discussed this problem earlier (or simillar ones):
Hello ๐
As mentioned in the previous thread, the flow is currently in beta
https://stripe.com/docs/payments/build-a-two-step-confirmation
However, you can integrate
1/ Place a hold on payment method flow to run actions prior to charging the payment method
https://stripe.com/docs/payments/place-a-hold-on-a-payment-method
2/ Build a webhook endpoint to run actions after the payment has succeeded
https://stripe.com/docs/webhooks
Thanks for quick reply and Hi! It would be great if there will be a way to execute code right before the user attempts to pay me (the after version is much easier).
There aren't any events that are generated for that scenario really. Because the customer can attempt to pay literally any time they want and it is possible that they choose to abandon the payment in the middle of the attempt.
So an alternative here would be to place a hold on the payment method and consider that as a payment attempt
As I mentioned in the prev threads auth & capture is a perfect choice for me but only a few payment methods support it.
(For example, two main LPM payment methods in my country does not support it)
I see. Yeah unfortunately the options are limited when it comes to your usecase.
Another option that I can think of is to listen to Element events and run your own custom logic
https://stripe.com/docs/js/element/events/on_change?type=paymentElement
you would listen to onChange event and check if the element is complete
that shows if all required fields on the element have been filled
That would be good but the suspicious user then might start cheating on me.
Because stripe.js is client-sided library.
I've been struggling with this problem for quite some time
Totally understand. Unfortunately, those are the only options available.
Thanks for your help. I will rethink and if will have problems I will write on dev-help.
But I still have several questions
For example: How fast is the 'payment_suceeded' and 'payment_processing' webhooks distributed?
Is it safe to use them in buissnes-critical situations.
They are sent quickly, like within a second usually. We typically also recommend listening for client signals and reacting to the first one that you get
If there are made two payments at "the same" time is it possible to distinguish (by webhooks ) which one started processing earlier?
As in they go processing at different times and are completed at different times? Or something else
The created timestamp on the event object will tell you which was created first if that helps https://stripe.com/docs/api/events/object#event_object-created
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.