paypal pdt状态所有时间0

时间:2016-02-23 10:45:58

标签: php paypal paypal-pdt

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

<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>

在我的网址上启用自动退货:&#34; http://www.MYURL.it/paypal/success.php&#34;

on 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,我假设有错误...有人能帮助我吗?

2 个答案:

答案 0 :(得分:0)

当连接失败时,

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

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

答案 1 :(得分:0)

错误我

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