I would like to get a notification from PayPal when payment is done - From the regular account I can create a PDT code to nofify my site.
Is it possible to get a PDT code from sandbox? I cannot find this option.
sandbox.
in front of paypal.com
and visit the URL where you are logged into the sandbox account, and enable PDT there.PDT is for informational purposes only, and should never be used for anything important nor trigger any business logic necessary for fulfillment, as there are cases where the buyer will make a standard PayPal payment yet never return (for example, if their network connection was interrupted or browser crashed). PDT is a very old setting, even older than IPN -- both essentially exist for backwards compatibility with old websites that already use them. There is really no reason to be doing any new integration with PDT or IPN.
Instead, do an API integration of 'Create Order' and 'Capture Order', documented here. These routes should only return JSON (no HTML or text). (The second one should, on success, record any details about the transaction's capture in your database before returning its data)
Pair your two routes with the following approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server