Notification if customer closes browser window

Ticketticker
Contributor
Contributor

Hi,

 

after creating a payment and the redirect to paypal, what happens when the user closes the browser tab, without a payment.
Will there be an notification (IPN), so that I can delete the created payment in my database? 

If yes which status will PayPal send back?

If not, which is the best practice?

Login to Me Too
1 REPLY 1

angelleye
Advisor
Advisor

No, without a completed transaction there would be no IPN sent.  

 

If you are creating a "payment" record in your database I would simply hold off on creating that record until the IPN hits.  You can create that record within your IPN script.  No need to create a payment record if no payment has actually completed yet.

 

If what you mean is that you're creating an "invoice" record, and then including this invoice ID in the payment request to PayPal, then of course you would need to create that record before-hand so that you can include that ID in the PayPal details.  In this case what you might want to do is include a flag in your record like "completed" that would be a 1 or 0, or you could just go by the "payment_status" that would be included with IPN.  Then you could setup a CRON job on the server that runs once per day (or however often you want) to clean up all records where your flag shows it's not complete.  If you do this sort of thing, though, you'll want to account for records where the checkout could actually be happening as the CRON job runs, so you'll want to add a buffer to the time or something like that.

Angell EYE - www.angelleye.com
PayPal Partner and Certified Developer - Kudos are Greatly Appreciated!
Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.