Simple PayPal integration on your website

Online payment is the hype of today’s web world. For getting any service or product we prefer to online payment method and PayPal is the most secure payment gateway. If you have a very basic knowledge of PHP, you can easily implement the simple PayPal gateway in your site.

The Process to implement PayPal on your website:

We can simplify the process into 3 steps – PayPal button, PDT and confirmation. 

PayPal button

Put this code in the PHP file template where the payment button will appear.

You have to change the respective values like  email, item name, item number, amount, currency, success page link, cancel page link and form action live link.

PDT function

Create a PHP file called ‘paypal-pdt-functions.php’ and put the following code in that file. PDT means payment data transfer. When any payment made successfully, PayPal returns all the payment related info to the return URL so that you can get all those values in your application process.

You have to enable PDT from your PayPal account profile and you will get a PDT identity token, just copy that token and put the token value in this file.


You have a confirmation page, say success URL. Just put the following code on that page template. It will return the array values to show what you will get when any payment made successfully.

This tutorial shows the process using sandbox mode. So, it is recommended to test everything on sandbox mode first and after successful testing you can put the total payment process on live mode.

Demo | Source code

Leave a Reply