in reply to How to safely/atomically process payments

This is a problem that has haunted pay sites for many, many years (as well as my dreams for that amount of time.)

The general case solution is to get a transaction "token" or ID number from the processor in advance of sending the actual transaction. Once you have the token (assuming Stripe supports this) you can log it along with an internal transaction ID and then send the transaction data along with the token included. By logging the token associated with a given transaction, you can then run a fairly simple cron job at regular intervals to see if any tokens have not been returned in a processed transaction and take steps as needed from there to rectify the problem.

I realize that this is a vague response, but keep in mind that this very problem has kept many programmers employed (and up late at night) for a long time now. A similar problem has been the notorious "double-click" form submission that could result in a double-billing. If this is a serious problem you could probably advertise on http://jobs.perl.org and find a competent person to help you resolve it.

The answer to the question "Can we do this?" is always an emphatic "Yes!" Just give me enough time and money.
  • Comment on Re: How to safely/atomically process payments