Hello everyone, I've just finished developing an ecommerce website and everything is working properly. However I sometimes have a problem when customers pay and close their browser, the order processing doesn't have time to finish. It's for a theater and creating tickets takes a bit of time. Unfortunately my host doesn't support queues, so I don't know how to solve this problem.
Have you encountered this problem before, or do you have any tips to help me?
Thanks in advance for your help, I'm stuck...
display a message so that the customers must not close the browser until they receive a confirmation on the screen, but this will probably not solve the problem for all the customers
save the order processing into the database and end all the non ended processes via a cron task
There is perhaps also a third possibility, but I really don't know so much about workflows and I never used this in any of my applications. But your case let me think about a workflow to end. So just an idea.
@grafixinfluenz You should be fulfilling orders using webhooks received from your payment processor, not relying on the user sticking around for the payment to process and your server to do whatever work after.
@vincent15000 Most payment processors (including Stripe and PayPal) allow you to configure webhook handlers, and they will then POST events to your website for things like a payment succeeding or failing.
Your application should be listening for these events and then take the appropriate action, rather than relying on a user to leave the browser window open and be redirected to a specific URL. Otherwise you run the risk of charging the customer, but then not creating or fulfilling their order if they closed the browser window, lose network connectivity, had a power cut, etc.
So, if you’re building a ticketing website, you should have a webhook handler listening for “payment succeeded” events that will then mark an order as paid and issue the tickets to the user.
@Snapey I guess that's the problem, since I have about 3% of such problems. I've tried several things to reproduce it locally and the only solution I've found is this one. Sometimes if a customer buys 4 tickets, only one is created and the others are not, so the process is interrupted... I must admit I'm a bit wary of how this works.