In this tutorial, I will explain how you can setup your PayPal account to automatically return(redirect) your customers  from PayPal to your site’s Thank You page after a payment.
Note: You need to have a PayPal business or premier account to be able to do this. Upgrading from a personal PayPal account to one of these accounts is free.
Steps for Setting up Auto Return:
Step 1:Â Log into your PayPal account.
Step 2:Â Go to My Account -> Profile
Step 3:Â Click on the selling tools link.
Step 4:Â Check the selling online section
Step 5:Â Look for “Website Preferences” and click the “Update” link on the far right hand corner of this row. See the following screenshot for reference
Step 6:Â You should now be on the “Website Preferences” menu.
a) Turn on the “Auto Return” for Website Payments
b) Enter a URL in the Return URL field (your thank you page URL)
c) Scroll down to Payment Data Transfer and enable it.
d) Scroll to the bottom of the page and click the Save button
e) PayPal will give a success message and show you your PDT ID Token
f) Copy the PayPal PDT ID token and use it where you need to specify it.
Note that PayPal does not do auto return if the customer doesn’t pay using their PayPal account.
Expected Behavior After You Enable Auto Return
Scenario 1) Customer pays via paypal account -> Gets automatically redirected to your thank you page.
Scenario 2) Customer pay via a credit card -> Gets shown a receipt page on Paypal -> The customer clicks a link on this page and gets sent to your thank you page.