payment gateway form php source code

Today, We want to share with you payment gateway form php source code.In this post we will show you payment gateway project in php free download, hear for payment gateway code in php we will give you demo and example for implement.In this post, we will learn about PayPal Payment Gateway PHP Source Code with an example.

Paypal payment gateway integration in php source code example

Step 1: Create Sendbox Account

Example 1:
In this step we will create sendbox account for test if you don’t have. So create here to create new account in Sendbox :

PayPal Payment Gateway PHP Source Code
PayPal Payment Gateway PHP Source Code

Step 2: Create Index File


<html lang="en">
    <title>PHP - Paypal Payment Gateway Integration -</title>
<body style="background:#E1E1E1">
<link rel="stylesheet" type="text/css" href="//" />
<style type="text/css">
		.price.panel-red>.panel-heading {
			color: #fff;
			background-color: #D04E50;
			border-color: #FF6062;
			border-bottom: 1px solid #FF6062;
		.price.panel-red>.panel-body {
			color: #fff;
			background-color: #EF5A5C;
		.price .list-group-product{
			border-bottom-:1px solid rgba(250,250,250, .5);
		.panel.price .list-group-product:last-child {
			border-bottom-right-radius: 0px;
			border-bottom-left-radius: 0px;
		.panel.price .list-group-product:first-child {
			border-top-right-radius: 0px;
			border-top-left-radius: 0px;
		.price .panel-footer {
			color: #fff;
			background-color:  rgba(0,0,0, .1);
			box-shadow: 0px 3px 0px rgba(0,0,0, .3);
		.panel.price .btn{
			box-shadow: 0 -1px 0px rgba(50,50,50, .2) inset;
	$paypalId='[email protected]';
<div class="container text-center">
	<h2><strong>PHP - Paypal Payment Gateway Integration</strong></h2>
	<div class="row">
		<div class="col-xs-6 col-sm-6 col-md-3 col-md-offset-4 col-lg-3">
    			<form action="<?php echo $paypalUrl; ?>" method="post" name="frmPayPal1">
					<div class="panel price panel-red">
						    <input type="hidden" name="business" value="<?php echo $paypalId; ?>">
						    <input type="hidden" name="cmd" value="_xclick">
						    <input type="hidden" name="product_name" value="Pakainfo website">
						    <input type="hidden" name="product_number" value="2">
						    <input type="hidden" name="amount" value="20">
						    <input type="hidden" name="no_shipping" value="1">
						    <input type="hidden" name="currency_code" value="USD">
						    <input type="hidden" name="cancel_return" value="">
						    <input type="hidden" name="return" value="">  
						<div class="panel-heading  text-center">
						<h3>PRO PLAN</h3>
						<div class="panel-body text-center">
							<p class="lead" style="font-size:40px"><strong>$20 / month</strong></p>
						<ul class="list-group list-group-flush text-center">
							<li class="list-group-product"><i class="icon-ok text-danger"></i> Personal use</li>
							<li class="list-group-product"><i class="icon-ok text-danger"></i> Unlimited projects</li>
							<li class="list-group-product"><i class="icon-ok text-danger"></i> 27/7 support</li>
						<div class="panel-footer">
							<button class="btn btn-lg btn-block btn-danger" href="#">BUY NOW!</button>

Step 3: Create Success File


$productNo            = $_REQUEST['product_number'];
$productTransaction   = $_REQUEST['tx']; 
$productPrice         = $_REQUEST['amt']; 
$productCurrency      = $_REQUEST['cc']; 
$price = '20.00';
if($productPrice==$price && $productCurrency==$currency)
    echo "Your Payment Successful, Good Luck";
    echo "Sorry, Dear Your Payment Failed";

Step 4: Create Cancel File


echo "Payment Canceled";

Step 5: Paypal URL

sendbox with paypal integration


I hope you get an idea about payment gateway form php source code github.
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.