paypal没有返回任何成功数据?

时间:2014-08-29 01:52:09

标签: paypal

我一直在通过post方法尝试使用简单的调用脚本,但是在成功时,paypal不会返回任何数据,如tx,amt,货币等等。通过它我可以确认付款并运行更新查询以更新发票状态到付款请...!

以下是我的成功页面代码:

<?php

$item_no            = $_GET['item_number'];
$item_transaction   = $_GET['tx']; // Paypal transaction ID
$item_price         = $_GET['amt']; // Paypal received amount
$item_currency      = $_GET['cc']; // Paypal received currency type

$price = '10.00';
$currency='USD';

//Rechecking the product price and currency details
if($item_price==$price && $item_currency==$currency)
{
echo "<h1>Welcome, Guest</h1>";
echo "<h1>Payment Successful</h1>";
}
else
{
echo "<h1>Payment Failed</h1>";
}

?>

所以,如果你们有人可以查看我的代码,请...!

2 个答案:

答案 0 :(得分:2)

Something is missing in your form here is the form:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payment">

  <input type="hidden" name="cmd" value="_cart" />

  <input type="hidden" name="upload" value="1" />

  <input type="hidden" name="business" value="business@test.com" />

      <input type="hidden" name="item_name_1" value="HP LP3065" />

  <input type="hidden" name="item_number_1" value="Product 21" />

  <input type="hidden" name="amount_1" value="100.00" />

  <input type="hidden" name="quantity_1" value="2" />

  <input type="hidden" name="weight_1" value="2" />

      <input type="hidden" name="on0_1" value="Delivery Date" />

  <input type="hidden" name="os0_1" value="2011-04-22" />

          <input type="hidden" name="item_name_2" value="Village Cinemas - Adult Vic/Tas Only" />

  <input type="hidden" name="item_number_2" value="Village Cinemas - Adult Vic/Tas Only" />

  <input type="hidden" name="amount_2" value="10.50" />

  <input type="hidden" name="quantity_2" value="1" />

  <input type="hidden" name="weight_2" value="0" />

            <input type="hidden" name="discount_amount_cart" value="21.05" />

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

  <input type="hidden" name="first_name" value="First Name" />

  <input type="hidden" name="last_name" value="Last Name" />

  <input type="hidden" name="address1" value="Address1" />

  <input type="hidden" name="address2" value="" />

  <input type="hidden" name="city" value="City" />

  <input type="hidden" name="zip" value="" />

  <input type="hidden" name="country" value="IN" />

  <input type="hidden" name="address_override" value="0" />

  <input type="hidden" name="email" value="email_address" />

  <input type="hidden" name="lc" value="en" />

  <input type="hidden" name="rm" value="2" />

  <input type="hidden" name="no_note" value="1" />

  <input type="hidden" name="charset" value="utf-8" />

  <input type="hidden" name="return" value="http://domain.com/success" />

  <input type="hidden" name="notify_url" value="http://domain.com/callback" />

  <input type="hidden" name="cancel_return" value="http://domain.com/checkout" />

  <input type="hidden" name="paymentaction" value="sale" />

  <input type="submit" name="custom" value="Submit" />

</form>

答案 1 :(得分:-1)

在这里:数据以后期形式返回,因此它可以通过:

print_r($_POST);