【问题标题】:paypal pdt status all time 0贝宝 pdt 状态一直 0
【发布时间】:2016-06-05 03:51:58
【问题描述】:

对不起,也许有更多关于这个论点的帖子,但我真的无法解决我的问题!也许我也有一些合乎逻辑的问题......有人可以帮助我找出正确的工作流程吗? 尝试使用贝宝配置我的网站时,我很头疼: 我已经创建了我的测试沙箱来尝试我的所有交易...... 我已经创建了按钮...

<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">
                <!-- nome oggetto -->
                <input type="hidden" name="item_name" value="myITEM Payment">
                <!-- numero oggetti -->
                <input type="hidden" name="item_number" value="myIdNumber:995">
                <!-- prezzo -->
                <input type="hidden" name="amount" value="10.99">
                <!-- bottone continua -->
                <input type="hidden" name="cbt" value="Continua" />
                <!-- tipo valuta -->
                <input type="hidden" name="currency_code" value="EUR">
                <!-- pagina in caso di annullamento -->
                <input type="hidden" name="cancel_return" value="<?php echo $url; ?>/cancel.php">
                <!-- pagina in caso successo -->

                <input type="hidden" name="return" value="<?php echo $url; ?>/success.php">

                <!-- immagine -->
                <input type="image" src="https://www.sandbox.paypal.com/it_IT/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
                <img alt="" border="0" src="https://www.sandbox.paypal.com/it_IT/i/scr/pixel.gif" width="1" height="1">
            </form>

在我的网址上启用自动返回:“http://www.MYURL.it/paypal/success.php”

在success.php上我粘贴了一些在其他帖子中找到的代码:

    <?php 
// The custom hidden field (user id) sent along with the button is retrieved here. 
if($_GET['cm']) $user=$_GET['cm']; 
// The unique transaction id. 
if($_GET['tx']) $tx= $_GET['tx'];
 $identity = $auth_token; //my paypal token
// Init curl
 $ch = curl_init(); 
// Set request options 
curl_setopt_array($ch, array ( CURLOPT_URL => 'https://www.sandbox.paypal.com/cgi-bin/webscr',
  CURLOPT_POST => TRUE,
  CURLOPT_POSTFIELDS => http_build_query(array
    (
      'cmd' => '_notify-synch',
      'tx' => $tx,
      'at' => $identity,
    )),
  CURLOPT_RETURNTRANSFER => TRUE,
  CURLOPT_HEADER => FALSE,
  // CURLOPT_SSL_VERIFYPEER => TRUE,
  // CURLOPT_CAINFO => 'cacert.pem',
));
// Execute request and get response and status code
$response = curl_exec($ch);
$status   = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// Close connection
curl_close($ch);
echo $status;
if($status == 200 AND strpos($response, 'SUCCESS') === 0)
{
    // Save the Record into the database
    echo "<h1>successo</h1>";
}
?>

echo $status 每次都给我 0,我假设有一个错误......有人可以帮助我吗?

【问题讨论】:

    标签: php paypal paypal-pdt


    【解决方案1】:

    我的错误:

    错误:14077410:SSL 例程:SSL23_GET_SERVER_HELLO:sslv3 警报握手失败0

    【讨论】:

      【解决方案2】:

      CURLINFO_HTTP_CODE 连接失败时返回0,添加以下代码 sn -p 打印错误详细信息并检查您的服务器与https://www.sandbox.paypal.com的连接

      if(curl_errno($ch)){   
          echo 'Curl error: ' . curl_error($ch);
      }
      

      【讨论】:

        猜你喜欢
        • 2016-04-07
        • 2021-02-12
        • 2018-03-18
        • 2012-01-21
        • 1970-01-01
        • 2011-01-26
        • 2016-04-12
        • 2018-12-21
        • 2012-05-16
        相关资源
        最近更新 更多