PayPal is one of the best international payment gateway. Here, we will show the complete source with a demo in PHP and MYSQL database. You can integrate PayPal payment gateway using PHP and MYSQL database. PHP scripts will help you create products, items, and checkout page. You will be able to create a shop and pay with PayPal. The database will be used to create the product for shop, for PayPal configuration details, and for PayPal payments. It's simply designed for PayPal payment gateway integration using PHP and MYSQL database. In this source, you will get different features and reliable source codes. If you want to integrate PayPal payment gateway on your website, for your store and e-commerce website, you have to focus on all approaches.
If you are looking for –
You will get all the features in this application source.
Let's understand the features of PayPal payment gateway integration web application source.
This web application source is created in PHP with an MYSQL database.
In this application, you first get a shop page in which all the products are displayed. All these products are displayed by fetching from the database table. These products have been used for PayPal payment gateway integration. All these products are displayed using HTML, CSS, MYSQL database and PHP script code. A customer can click on the buy now button for the checkout page. This is designed for the checkout page with the PayPal payment gateway.
PayPal checkout page means that when a customer clicks the Buy Now button, it gets redirected to the checkout page where the details of the product like - Product Price, Product Description, Paypal Pay Now button. Paypal checkout page is developed using PHP, MYSQL, HTML, CSS, and Paypal integration form.
When a customer clicks on the Pay Now button, he gets redirected to PayPal's website. After being redirected to the PayPal website, the customer can easily pay.
When the customer completes the payment, the customer is redirected from the PayPal website to the merchant store (Seller website). This is the important page of the Paypal Payment Gateway Integration, known as the success page. When payment is successfully accessed on PayPal, the first IPN file is executed and the PayPal data is stored in the database (Seller database). IPN file is used to keep it safe from fake transactions, which work as a secure layer between PayPal & Merchant Store databases. The customer receives full details on the Success page.
A customer can download the invoice in PDF format. This web application source is created with fpdf . This is another good feature of PayPal Integration web application in PHP, which has been made using fpdf , MYSQL database, and PHP script codes. A customer can download the invoice in PDF format for future reference.
Along with the PDF invoice, another feature has also been created by which the customer can download the invoice in an Excel file. This is very simple code in PHP with MYSQL database. You can customize this PHP script according to your needs.
PayPal payment gateway integration is simple and short. If you need an order page with payment integration, you can use the order by the customer page. This page is developed for the seller admin page. You can easily customize the order page. In this page, the seller (Merchant) can check how many orders have been made.
After the payment is successful, an email is sent to the customer's email ID, which contains PayPal transaction details and product details. This is another feature of the PayPal payment gateway integration application. It can be easily customized. You can change details in the success PHP file.
If you want to integrate PayPal payment gateway in PHP, you have to provide PayPal configuration details. This is the main page to set up and install the PayPal payment gateway in PHP with an MYSQL database. It contains the configuration details. You have to fill up all the details in the form. The most important part of this form, you can set Test and Live mode easily in one click.
Let’s discuss the PayPal integration and installation process.
Paypal integration and installation process are really simple. Follow the steps below.
1. Use your live server because the mail function does not work on the localhost. Upload the complete source in any folder of your website.
Like – example.com/gateway or example.com/demo/gateway, where you want to upload.
2. You will get the database in the source folder and import that database “gateway” on the live PHPMyAdmin database. Import and save.
3. Open the config.php file and provide the details below.
4. Open setup.php file and fill up the details below.
$databaseHost = 'host address'; //Your live host address $databaseName = 'your database name '; // your db_name (Database Name) $databaseUsername = 'your username '; // Live database username $databasePassword = ' your password'; // liver server db pass
PayPal Email Id- First of all, we test the PayPal integration system is works or not. Create two sandbox email for testing purpose. You can create two emails in the link below or search developer PayPal on google.
Login with your Paypal business email. Create two sandbox email.
I. For the seller ( Merchant Email ) – Use as Paypal id in the setup form
II. For buyer (Buyer email ) - Use at payment time
Set the password for both emails. View and edit the account to set password, first name, last name, and email whatever you want the update.
5. Open PayPal sandbox login using the link below.
Paste your success.php file URL here.
Like – example.com/gateway/success.php
Check path yourself
Cheek more details –
Payment data transfer< - On /p>
Block non-encrypted website payment - Off
If you are unable to install using the above details, watch the demo video. Click on demo and watch a complete demo with installation support
There are many files and folders in the web application source. Let’s discuss the folders and files.
1. Assets Folder– The assets folder is contained CSS, images, and icon folders. In this PayPal payment gateway integration system, we fetch and display product data from the images folder. We are designed to complete the application using CSS. You can edit style.css from the CSS folder inside the assets. Icon folder is contained icons for pdf and excel.
2. Database folder – The database is saved in the database folder. You can easily import the database files to live servers. Three tables have been created in this database file. Paypal payment gateway requires the product details, payment for success data and configuration data. We created three tables. You will get three tables after import “gateway” database.
I. Shop_items – The shop_items table is created for products. We use this table to fetch and display the data on the web page. You can easily customize this table.
II. Shop_payments – The shop_payments table is created to post-transaction data from the PayPal website. The shop_table is containing fields below –
|`payment_id` int(100) NOT NULL||( Payment id for normal Id )|
|`item_number` varchar(50) COLLATE utf8_unicode_ci NOT NULL||(Product unique number )|
|`txn_id` varchar(50) COLLATE utf8_unicode_ci NOT NLL||( Paypal variable - transaction id )|
|`payment_gross` varchar(50) NOT NULL||(Paypal variable - paid amount )|
|`currency_code` varchar(5) COLLATE utf8_unicode_ci NOT NULL,||(Paypal variable - Currency code )|
|`payment_status` varchar(20) COLLATE utf8_unicode_ci NOT NULL||(paypal variable - payment status )|
|`payer_email` varchar(50) COLLATE utf8_unicode_ci NOT NULL||(Paypal variable - buyer email)|
|`first_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL||(paypal variable - buyer first name )|
|`last_name` varchar(64) COLLATE utf8_unicode_ci NOT NULL||(paypal variable - buyer last name )|
|`payer_id` varchar(50) COLLATE utf8_unicode_ci NOT NULL||[paypal variable - payer id(Buyer Id) ]|
|`address_country` varchar(50) COLLATE utf8_unicode_ci NOT NULL||(paypal variable - address of buyer )|
|`payment_date` datetime NOT NULL||(paypal variable - date of payment )|
|`ref_no` varchar(255) COLLATE utf8_unicode_ci NOT NULL||( Custom reference number )|
You can use another paypal variables . Add more columns if you need .
fpdf Folder – The fpdf folder is used to create an invoice in the pdf file. You do not need to change in fpdf file. Just leave it the same.
Cancel.php The cancel file is just a message file after canceling the payment. In Paypal payment gateway, when a customer cancels the payment, he gets redirected to the cancel page. You can edit the cancel page message anytime.
Your transaction has been CanceledTry Again
Index.php – The index.php file is created to fetch and display the product using PHP and MYSQL page. This is a home page of this web application. You can manage the product from this file. To integrate PayPal payment gateway in PHP, we display products on-website page and customers can select any product.
Checkout.php – The checkout page is created for the payment process via PayPal. The checkout page contains the PayPal form and integration details. Paypal form is important to integrate the PayPal payment gateway in PHP. You can change the details of the product here. Change the PayPal configuration details from the setup file.
Setup.php - The setup form has been created to set or update the PayPal configuration details. You can change the configuration details in this file or form. This form makes the PayPal integration process easier.
Config.php – This is a connection file. You can set connection details in this file.
config-details.php- Integrate Paypal payment gateway is very easy if you create a PayPal integration configuration file. The config-details file has been created to set PayPal configuration details from the setup form. You can include this file where you need it. We included this file in the checkout.php page and the IPN page for PayPal secure payments. You can change PayPal configuration details from the setup form. This is really easy.
ipn.php- This is another PHP file. The ipn file is used to verify the transaction details and insert the data into the database. We insert the data from this file.IPN ensures secure payment data and restricts fake data from customers. It verifies the data from the database and posts unique data at every payment. You can set post variables in this file. IPN is a layer between the PayPal payment gateway and the success page.
Success.php – When a customer completes payment on PayPal, then he gets redirected to the Success page. Transaction details can be easily viewed on this page. On this page, invoices can also be downloaded in PDF and Excel format. Transaction details taken from PayPal from this file can be easily customized. The email notification code can be more easily designed or customized from this file. The mail function has been used in this PHP file, through which transaction details and product details are sent automatically to customer email. This is another important file in payment gateway integration.
invoice-pdf.php – This file is used to download the invoice in PDF file. You can customize invoices in this PHP script.
download-excel.php- Download the invoice in an excel file.
Orders.php- This is the last and important file of PayPal Payment Gateway Integration. Through this file, the seller can check how many orders have been made.
In this way, you can integrate PayPal payment gateway in PHP.
1. Choose payment option (paypal or payumoney) and click on Pay & Download button.
2. Complete your payment.
3. You will get login and register button after payment success . Login or register to download complete source .
4. Login and download the source file.