1

I know the difference between IPN vs PDT because this is an old topic and I've found some articles here on stackoverflow.

But I still cannot figure out what the best practice is when you offer digital downloads and you want your customer to be redirected to your thank you page so he can download the purchased product.

If I had to choose one: Is IPN sufficient?

I read great articles discussing using both. But the problem is that woocommerce sends out the confirmation email twice. How can I implement this? Didn't find a tutorial on this.

Help is very much appreciated.

I found these great ressources:

https://developer.paypal.com/docs/ipn/integration-guide/IPNPDTAnAlternativetoIPN/#

IPN vs PDT in Paypal

mika2019
  • 404
  • 4
  • 16

1 Answers1

1

PDT is for extra informational purposes only. It can never be relied on for anything important, because the customer may never return to your site after a successful Payments Standard transaction. Their browser may crash, or PayPal may be obligated to show them a receipt, and they may not click to return. Don't bother using PDT for anything of any importance, ever.

IPN is theoretically a reliable asynchronous delivery service, so you can use it to mark something as paid and send an email with the download link. When the customer does return, hopefully the IPN will have already processed and you will also be able to mark a download as ready that way.

The most robust solution is to depend on neither of the above, and instead used a server-based integration for payment creation (via v2/orders API) and capture (again via v2/orders API), so you get an immediate API response about the success of the capture. The front-end to pair with such a server-based integration is: https://developer.paypal.com/demo/checkout/#/pattern/server

Preston PHX
  • 27,642
  • 4
  • 24
  • 44
  • thanks for your great explanation! the reason why I switched to PDT is that the customer didn't see the download on the redirected thankyou page (as you mentioned as well)... so I tried both versions (now the customer can download the product, great!) but the problem I'm facing now: the customer gets two 'order confirmation' emails because woocommerce gets IPN & PDT and reacts on both... do you know a solution of this issue (other than the link you kindly sent - I cannot (not able to) implement this within woocommerce) – mika2019 Apr 11 '20 at 11:33
  • There is a WooCommerce module with Smart Payment Buttons, although I haven't looked at how it handles payment confirmation: https://woocommerce.com/woocommerce-and-paypal/ – Preston PHX Apr 11 '20 at 16:41
  • If you are using both IPN and PDT for some reason, they should be able to first check and see if the order has been marked as paid, before sending a new confirmation email. That way whichever runs first does what you need, and the second one doesn't do a duplicate. – Preston PHX Apr 11 '20 at 16:43