I have a website which allows users to pay using paypal. I use paypals IPN to find out if the payment was successful or not.
Everything works fine as long as the complete, cancel, pending, failed etc ipn responses are quick. However, I need to stop users from paying more than once if paypal is slow at sending an ipn response.
For example, if paypal is going to send a complete response, in which case it will not send a pending response. If paypal takes 5 minutes to do that. How do I stop users from paying twice within those 5 minutes?
This is how I usually use PayPal:
That's it, don't forget to send the order number you saved locally to PayPal in the
custom
field.Before proceeding, be aware of the following: If a user is redirected to PayPal - but closes the window, you have no way of knowing if the order will be payed or not. If he clicks cancel, you can send to PayPal a cancel url, where you will receive the information and mark the order as cancelled.
PS:
In step 3 you can tell the user you already have a pending order from them, and they should only proceed if they don't want to pay the previous order.