Paypal 返回网址给出空白数组

标签 paypal

  <form id="dvrr" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<table border="0" cellpadding="5" cellspacing="5" align="center" width="100%">
  <tr>
    <td></td>
    <td><input type="hidden" name="business" value="ceo@world-airport-city-transfer.com">

      <!-- Specify a Buy Now button. -->

      <input type="hidden" name="cmd" value="_xclick">

      <!-- Specify details about the item that buyers will purchase. -->

      <input type="hidden" name="item_name" value="Cab Booking">
      <input type="hidden" name="item_number" value="<?php echo $orderid; ?>">
      <input type="hidden" name="amount" value="<?php echo number_format((float)$data['price'], 2, '.', '');  ?>">
      <input type="hidden" name="currency_code" value="USD">

      <!-- Specify URLs -->

      <input type="hidden" name="cancel_return" value="http://www.wer.com/payment-cancel/">
      <input type="hidden" name="return" value="http://www.wer.com/payment-processing/">
      <input type="hidden" name="notify_url" value="http://www.wer.com/notify-payment/">

      <!-- Display the payment button. -->

      <input type="image" name="submit" border="0" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" alt="PayPal - The safer, easier way to pay online">
      <img alt="" border="0" width="1" height="1" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" ></td>
  </tr>
</table>

这是我用于付款的 PayPal 表单,在感谢页面上,我们添加代码以获取响应并在我们的系统上更新交易是否完成。

我们将此代码放在 weburl.com/payment-processing/上,这是我们的返回 URL

$data=$_POST;

        if($_POST['payment_status']!=''){
        $item_name=$_POST['item_name'];
        $item_number=$_POST['item_number'];
        $txn_id=$_POST['txn_id'];
        $payer_email=$_POST['payer_email'];
        $payment_gross=$_POST['payment_gross'];
        $payment_status=$_POST['payment_status']; 

        $insert = mysql_query("INSERT INTO cr_payments(item_name,item_number,txn_id,payer_email,payment_gross,payment_status) VALUES('".$item_name."','".$item_number."','".$txn_id."','".$payer_email."','".$payment_gross."','".$payment_status."')") or die(mysql_error());
        global $wpdb;  
        $is_added = $wpdb->query("UPDATE cr_booking SET fld_booking_status = '$payment_status' WHERE fld_booking_id = '$item_number'");

但是当我们在沙盒模式下运行代码时我们得到数据..但是在实时模式下我们得到空白数组

最佳答案

PayPal 网站支付标准,包括您使用的 PayPal 按钮,不会将任何内容带回您的返回 URL。

在跳转到 PayPal 支付页面之前,您必须在购物车中存储数据。

您可以使用的另一种 PayPal 产品是快速结帐,它与您正在使用的产品截然不同。它需要你编写你的服务器和PayPal之间的API调用,但实际收费是通过在你的服务器上调用doexoresscheckout来完成的,所以你可以根据这个API调用的结果来决定显示什么。

关于 Paypal 返回网址给出空白数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30821923/

相关文章:

PayPal智能按钮,如何始终在新选项卡中打开信用卡?

php - 如何将 PayPal 经典支付表单转换为 PayPal REST API PHP 应用程序?

javascript - 使用 Sandbox 的 PayPal 按钮未显示

php - 如果用户不是来自 HERE,则不处理 - 如何处理?

ios - PayPal iOS 模拟器应用程序接受无效密码

asp.net - Paypal 自适应支付返回 url 被调用两次

java - PayPal REST API java sdk - 自定义配置文件

php - 麻烦整合 Paypal 信用卡支付

php - 如何在 PayPal PHP SDK 中设置 PayPal 帐户详细信息?

php - 根据表单中的行数将项目添加到购物车