paypal支付网关集成

I am integrating paypal payment gateway in one of site.After successful payment i am redirecting it to success.php file. In success.php file i have included all the insert parameters and a success message. It is redirecting to success.php file properly after making payment but showing payment failed message and no data is inserting to the database. following is my success.php page code

<?php
 include 'dbConfig.php';


//Get payment information from PayPal
$item_number = $_GET['item_number']; 
$txn_id = $_GET['tx'];
$payment_gross = $_GET['amt'];
$currency_code = $_GET['cc'];
$payment_status = $_GET['st'];

//Get product price from database
 $productResult = $db->query("SELECT price FROM products WHERE id = = '".$item_number."'"); 
$productRow = $productResult->fetch_assoc();
$productPrice = $productRow['price'];

if(!empty($txn_id) && $payment_gross == $productPrice){
//Check if payment data exists with the same TXN ID.
$prevPaymentResult = $db->query("SELECT payment_id FROM payments WHERE txn_id = '".$txn_id."'");

if($prevPaymentResult->num_rows > 0){
    $paymentRow = $prevPaymentResult->fetch_assoc();
    $last_insert_id = $paymentRow['payment_id'];
}else{
    //Insert tansaction data into the database
    $insert = $db->query("INSERT INTO   payments(item_number,txn_id,payment_gross,currency_code,payment_status) VALUES('".$item_number."','".$txn_id."','".$payment_gross."','".$currency_code."','".$payment_status."')");
    $last_insert_id = $db->insert_id;
}
 ?>
<h1>Your payment has been successful.</h1>
<h1>Your Payment ID - <?php echo $last_insert_id; ?></h1>
<?php }else{ ?>
<h1>Your payment has failed.</h1>
<?php } ?>

what i am doing wrong?

As suggested by Van Hoa, paypal does not send payment information as parameters when you redirect a user to your success page. PayPal will only send back a token and a payer ID.

When redirecting the buyer back to your website from paypal.com, PayPal appends the Express Checkout transaction token and the unique PayPal buyer ID as GET parameters to your RETURN URL; these GET parameters are named token and PayerID.

PayPal docs (emphasis added)

You can use the returned token to get the payment details using GetExpressCheckoutDetails and passing it the token you get back from PayPal.