Reputation: 28309
I am implementing IPN + PDT the situation is:
IPN coming from paypal, after that i am validating IPN sending it back to paypal(validation taking some time) and if all good i am setting the flag in database that IPN is OK(transaction still staying not payed). Than PDT getting fired when user landing to my sate from paypal and only at that time i am setting the current transaction as payed after i validate the transaction id and checking if IPN status of that translation was OK.
So, all looking good so far in development environment(my dev PC + paypal sandbox), but theoretically it could happend that before IPN precessed/completed (IPN validation delayed, taking more time because of some reason) the PDT could be fired and as a result transaction could not marked as payed and it would be a problem.
I googled that and found What is the sequence of Event Firing - IPN & PDT saying:
So, appearantly IPN fires before PDT. But sometimes, PayPal dont get http 200 ok from your website (for some reason) and then paypal thinks that IPN was not fired properly, then PayPal send IPN again after a while. In that case, there is the chance to get PDT fired before IPN.
Could someone confirm that:
Upvotes: 1
Views: 339
Reputation: 19356
Don't use PDT for order management. PDT is meant as a somewhat easy solution to display transactional details to your buyer when they return back to your website. It should not be relied on to handle order management tasks, since (as you mentioned as well), it depends on the buyer returning to your website, which may not happen in all circumstances.
IPN is reliable in that it always POST's to your IPN script.
As for the sequence of PDT vs IPN: There is none, since PDT is a pull request (from you to PayPal), and IPN is push (from PayPal to you).
In short; drop PDT, unless you use it to display a nice "welcome back $user" message, and use IPN to verify the payment went through and update your database accordingly.
Upvotes: 2