On my recent project, I was suppose to give my users access to the members area as soon as they complete the payment. I was using Paypal as the mode of the payment as this is the most widely used and is available for most of the countries.
By default, user is presented with the buy now button, which takes them to paypal for the payment and on successful payment, users are presented with options as shown in image below, where users need to click on the link to get back to our webpage.
My requirement was different, I was suppose to get buyers back to my website after they complete the payment process automatically and validate transaction to create a member and log in successfully, displaying them their dashboard page with thank you message and a summary of their payment. Paypal provides us with the Auto Return and Payment Data Transfer(PDT) features for this purpose. Below, I have listed out the steps to enable the Paypal auto return and PDT:
- Login to your Paypal Business Account.
- Navigate to “My Selling Tools” under Profile menu. Refer to screenshot below:
- Under Selling online category, locate “Website preferences” and click on “Update” button showing next to it. Refer to screenshot below:
- You will be presented with the Website preferences page with Auto Return, Return URL, PDT and other options as below:
- Select “on” for the Auto Return and Payment Data Transfer radio button. For Return URL, you need to mention the link to your webpage, where you wish to redirect your buyers or where the whole processing after the payment takes place. Refer to 3 red boxes above in the screenshot.
- Scroll to the bottom of the page and click on the Save button to Save the settings. Once saved you will be presented with the Identity token at the bottom of “Payment Data Transfer” section. You will need this token to access and call Paypal servers to validate transactions.
These steps, ensures that you successfully completed setting up Paypal Auto Return and Payment Data Transfer feature on Paypal Business Account. Next step is to add the transaction validation code to the Return URL we just saved. I will cover this up on my next article, explaining details on setting up Paypal PDT with sample code.