PHP – Paypal Payment Gateway Integration

PHP – Paypal Payment Gateway Integration

In this Post We Will Explain About is PHP – Paypal Payment Gateway Integration With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to PHP PayPal Integration Example

In this post we will show you Best way to implement PayPal Standard Payment Gateway Integration in PHP, hear for Paypal payment gateway integration in php source code examplewith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Enable Auto Return In Your Test / Sandbox Account.

HOW TO SET UP / ENABLE AUTO RETURN

Step 1: First of all Log into https://developer.paypal.com
Step 2: And then Click Applications
Step 3: Now Click Sandbox accounts
Step 4: Expand the account in some question
Step 5: and then Click Sandbox site
Step 6: After that Login to the simple test account
Step 7: here link to Copy and paste simple “https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_profile-website-payments”
Step 8: into past your browser
Step 9: and then Enable Auto Return as well as click Save
Step 10: now last step provide the Auto Return URL as well as click Save

config.php

<?php
// config Your test paypal simple sandbox url, and then Replace it with like as a live url after successful some testing.
DEFINE('PAYPAL_URL', 'https://www.sandbox.paypal.com/cgi-bin/webscr'); 
 
// Set paypal marchent id.
DEFINE('PAYPAL_ID', '[email protected]');  
// We can find This in your developer account it look like as a "[email protected]"
 
// Devloped by Pakainfo.com Define your some base currency
DEFINE('CURRENCY', 'USD');
?>

index.php

<?php
 require_once('config.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!-- Include Your meta tags -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Pakainfo.com - INTEGRATE PAYPAL PAYMENT GATEWAY IN PHP</title>
<!-- Include Your Script -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
</head>
<body>
<!-- Include Your Body Content -->
<div class="panel panel-success">
<div class="panel-heading"><h3>Step By step Paypal Payment Gateway in PHP</h3></div>
<div class="panel-body">
<p class="bg-info" id="msg"></p>
<!-- Devloped by Pakainfo.com Your Body Content -->
 <form class="form-horizontal" role="form" id="paypalForm" method="post" action="<?php echo PAYPAL_URL; ?>">
 <!-- Devloped by Pakainfo.com Your Body Content -->
    <input type="hidden" name="business" value="<?php echo PAYPAL_ID; ?>">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="credits" value="510">
    <input type="hidden" name="userid" value="1">
    <input type="hidden" name="cpp_header_image" value="">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="handling" value="0">
    <input type="hidden" name="cancel_return" value="http://lab.iamrohit.in/paypal-php/request.php?type=cancel">
    <input type="hidden" name="return" value="http://lab.iamrohit.in/paypal-php/request.php?type=success">
<!-- Devloped by Pakainfo.com Your Body Content -->
  <div class="form-group">
    <label class="control-label col-md-2" for="amount">Amount:</label>
    <div class="col-md-10">
      <input type="text" class="form-control" name="amount" placeholder="provide Amount"  value="10">
    </div>
  </div>
     <div class="form-group">
    <label class="control-label col-md-2" for="currency">Quantity:</label>
    <div class="col-md-10">
      <input type="text" class="form-control" name="quantity" placeholder="provide Quantity" value="1" >
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-md-2" for="currency">Currency:</label>
    <div class="col-md-10">
      <input type="text" class="form-control" name="currency" placeholder="provide Currency Type" value="<?php echo CURRENCY; ?>" >
    </div>
  </div>
  <div class="form-group">
    <label class="control-label col-md-2" for="description">Description:</label>
    <div class="col-md-10">
      <textarea class="form-control" name="item_name" placeholder="provide Description">My First Payment</textarea>
    </div>
  </div>
  <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
      <input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="How to Set Up Paypal Payment Gateway Integration in PHP!">
    <img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
    </div>
  </div>
</form>
</div>
</div>
<!-- Include Your Script -->
 <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>

request.php

<?php
$type = $_GET['type'];
if($type == 'success') {
  echo "<pre>";
  var_dump($_REQUEST);
  echo "<h1>Your Live Payment Successful</h1>";
} 
 
if($type == 'cancel') {
  echo "<h1>Your Payment Canceled(Sorry.!!!)</h1>";
}
?>

PayPal Integration In PHP – Source Code Download!

Simple Grab a free Latest copy of Paypal API Integration Demo from Github.

Read Also:  Escrow with Paypal Payments Pro API Integration Using PHP

Example

I hope you have Got What is PayPal Standard Payment Gateway Integration in PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.