Currently I have a script which processes orders after someone is directed to a payment processor.
The payment processor will occasionally send two (or more) responses to my site (usually within a minute of the first response).
I have contacted the payment processor about the issue; they don't see this as an issue with their system and say my script should take into account any extra responses and only listen to the last one sent.
On multiple response orders, the first response is successful, and so the order is processed when this response comes in.
If a 2nd response comes, its usually about 30 seconds later with an error response and I cancel the order.
The problem is that I have already sent out a "thank you for your order" email to the customer from the first response, which obviously isn't ideal.
Is there a way to trigger a separate script to run a few minutes after the order is processed? i.e to check if the order is still valid a couple of minutes after the original order and send the email out
I was thinking a cron job which runs every minute, but surely this would be overkill since the script only needs to run if an order has been placed?