PayPal Payment Gateway PHP Source Code

Today, We want to share with you PayPal Payment Gateway PHP Source Code.In this post we will show you paypal payment gateway integration in php source code download & How to Set Up Paypal Payment Gateway Integration in PHP, hear for Payment gateway integration in PHP With Database Connection we will give you demo and example for implement.In this post, we will learn about Paypal payment gateway integration code with PHP, Mysql project with an example.

PayPal Payment Gateway PHP Source Code

There are the Following The simple About payment gateway in php source code Full Information With Example and source code.

As I will cover this Post with live Working example to develop Paypal Payment Gateway Integration in PHP, so the PayPal PHP Website Integration Tutorial for this example is following below.

PHP โ€“ Paypal Payment Gateway Integration Step By Step

Step 1: create a PHP file

Paypal Example PHP Source Code

CREATE TABLE `payments` (
 `item_number` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 `txn_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 `payment_amount` float(10,2) NOT NULL,
 `currency_code` varchar(5) COLLATE utf8_unicode_ci NOT NULL,
 `payment_status` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Step 2: PHP Source Code


<!DOCTYPE html> 
<html lang="en"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

<title>Paypal :: PayPal Payment Gateway Integration in PHP with mysql </title> 



    <form action="" method="post">        

        <input type="hidden" name="business" value="paypal_username">         

        <!--PHP Specify a Buy Now button. --> 

        <input type="hidden" name="cmd" value="_xclick">         

        <!-- Specify details about the item that buyers will purchase. --> 

        <input type="hidden" name="item_name" value="item_name"> 

        <input type="hidden" name="item_number" value="item_number"> 

        <input type="hidden" name="amount" value="Item_amount"> 

        <input type="hidden" name="currency_code" value="USD">        

        <!--PHP Specify URLs --> 

        <input type='hidden' name='cancel_return' value=''> 

<input type='hidden' name='return' value=''>         

        <!-- PHP Display the payment button. --> 

        <input type="image" name="submit" border="0" 

        src="" alt="PayPal Payment Gateway Integration in PHP with mysql"> 

        <img alt="" border="0" width="1" height="1" src="" >     



Setp 3: database connection


define('HOST', 'localhost'); 

define('USERNAME', '{Jaydeep_gondaliya}'); 

define('PASSWORD', '{[email protected]#$%&89865}'); 

define('DATABASE_NAME', 'my_shop'); 

//MySQL Database Connect and select the database 


if ($db->connect_error) { 

    die("Connection failed: " . $db->connect_error); 


Step 4 : Save Data

Useing item_no,transaction_id,amt,currency_code,payment_status

Also Read This ๐Ÿ‘‰   How to use multiple databases in Laravel

And then Last Step I need to make a simple success file as well as show some transaction details which data received from paypal .


include 'connection.php'; 

//save all the Useful PHP value Trasaction information form PayPal 

$item_number = $_GET['item_number']; 

$txn_id = $_GET['Trasaction_ID']; 

$payment_gross = $_GET['AMT']; 

$currency_code = $_GET['CURRENCY_CODE']; 

$payment_status = $_GET['PAYMENT_STATUS']; 


        //Insert tansaction data into the database 

        $insert = $db->query("INSERT INTO payments(item_number,txn_id,payment_amount,currency_code,payment_status) VALUES('".$item_number."','".$txn_id."','".$payment_gross."','".$currency_code."','".$payment_status."')"); 

        $result_payment_id = $db->insert_id;  

<h1>Good Luck, Your payment has been successful.</h1> 
    <h1>here display, Your Payment ID - <?php echo $result_payment_id; ?>.</h1> 
<h1>Your payment has failed.</h1> 


Angular 6 CRUD Operations Application Tutorials

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PayPal Payment Gateway PHP Source Code.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.