Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Implementation of PayPal IPN and PDT

I’m creating an android application that uses PayPal as a payment method. I have already implemented IPN in PHP but I have some questions about the PDT. From what I understood, the PDT is a notification that occurs when the user pays and returns to the merchant website. My question is, what if the user before being redirected closes the PayPal page? The user never visits the "return page" and I don’t receive any immediate notification about the purchase.

I’m selling digital products, so I can’t wait for the IPN to allow the user to download the product, as it could take several minutes or even hours to arrive.

What do you think I can do? Do you have any suggestions? Thanks.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

PDT and IPN are ~20 years old. PDT in particular is only suitable for informational purposes, since as you mention the user may never return to the redirect page–for any number of reasons. IPN can be relied on but is an asynchronous notification and may delay as you also mention.

The best solution is to use neither of those very old things, and instead capture transactions with a v2/checkout/orders API call. This gives an immediate, synchronous notification when a transaction completes.


Create two routes, one for Create Order and one for Capture Order (first using a function that obtains an access token). These routes should return/output only JSON data (no HTML or text).

Pair those two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading