Paypal Payment using PHP

In this tutorial I want to explain how to work with Paypal Sandbox test accounts for payment system development and sending arguments while click buy now button. It’s simple and very easy to integrate in your web projects.

Create a Paypal Sandbox test account at


    $paypal_url=''; // Test Paypal API URL
//	$paypalUrl=''; Live Paypal API URL

    $paypal_id='Business email ID';  // Business email ID

<div class="product">            
    <div class="price">
    <div class="btn">
        <form action="<?php echo $paypal_url; ?>" method="post" name="frmPayPal1">
            <input type="hidden" name="business" value="<?php echo $paypal_id; ?>">
            <input type="hidden" name="cmd" value="_xclick">
            <input type="hidden" name="item_name" value="Script gurus Payment">
            <input type="hidden" name="item_number" value="1">
            <input type="hidden" name="credits" value="510">
            <input type="hidden" name="userid" value="1">
            <input type="hidden" name="amount" value="10">
            <input type="hidden" name="no_shipping" value="1">
            <input type="hidden" name="currency_code" value="USD">
            <input type="hidden" name="handling" value="0">
            <input type="hidden" name="cancel_return" value="http://localhost/paypal/cancel.php">
            <input type="hidden" name="return" value="http://localhost/paypal/success.php">  
            <input type="image" src="" border="0" name="submit">
            <img alt="" border="0" src="" width="1" height="1">


$no            = $_REQUEST['item_number'];
$transaction   = $_REQUEST['tx']; // Paypal transaction ID

$price         = $_REQUEST['amt']; // Paypal received amount

$currency      = $_REQUEST['cc']; // Paypal received currency type


    echo "Payment Failed";

Leave a Reply

Your email address will not be published. Required fields are marked *