GrafixInfluenz's avatar

post payment issue on Ecommerce Theatre website

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

0 likes
9 replies
vincent15000's avatar

Sure queues would be the best way.

But you can perhaps explore two other ways.

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

https://laravelworkflows.com/

1 like
GrafixInfluenz's avatar

@vincent15000 That's one of the ideas I had too, I'm just looking for the best way to eradicate the problem. Thanks for your reply.

martinbean's avatar

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

2 likes
martinbean's avatar

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

2 likes
Snapey's avatar

sounds like you are do doing too much in the browser?

When they press book tickets, everything else could run on the server and not care what the browser is doing

But who does this? who presses buy on anything and does not stick around to see if it worked?

Are you sure you are interpretting the problem correctly?

1 like
GrafixInfluenz's avatar

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

1 like

Please or to participate in this conversation.