当前位置: 首页 > 知识库问答 >
问题:

成功付款后无法检索Paypal信息

高恺
2023-03-14

客户端部分运作良好,客户端付款,钱在卖家账户中。第二部分允许恢复数据,如交易号码,金额,客户地址,不起作用。使用Paypal提供的脚本。

这是一个文件索引。支付工程费用


   
   
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
      <title>Radiofil</title>
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css"
            integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" 
    		crossorigin="anonymous">
      
    </head>
    <body>

    <nav class="navbar navbar-expand-lg navbar-dark bg-primary mb-1">

      <a class="navbar-brand" href="#">Boutique Tubes</a>


    </nav>

    <div class="container">

      <h1>Récapitulatif</h1>

      <table class="table table-striped">
     
        <thead>
        <tr>
          <th>Tube</th>
          <th>Qte</th>
          <th>Prix</th>
    	  
        </tr>
        </thead>
        <tbody>

         <?php 
    	     $user_id = 8000;
    		 $RefBonCommande= '20000';
    	include('../config/dbconn.php');
    $query = mysqli_query($dbconn,"SELECT * FROM detailcde WHERE user_id='$user_id' AND RefBonCommande='$RefBonCommande'") or die (mysqli_error());

     while ($row3 = mysqli_fetch_array($query, MYSQLI_NUM)) {


    $count = mysqli_num_rows($query);
    	
    $numerotube=$row3[3];
    $qty= $row3[4];
    $totalp = $row3[5];

          echo "<tr>";
          echo  "<td>".$numerotube."</td>";
    	  echo "<td>".$qty."</td>";
    	  echo "<td>".$totalp.'€'."</td>";
    }
    	$query1 = mysqli_query($dbconn,"SELECT * FROM commandes WHERE Refcde='$RefBonCommande' AND adherent1='$user_id'") or die (mysqli_error()); 
    	$row4 = mysqli_fetch_array($query1);
    	$port=$row4['FraisTransport'];
    	$total=$row4['Total'];
    	  echo "<tr>";
          echo  "<td>".'Total + port '."</td>";
    	  echo "<td>".'1 '."</td>";
    	  echo "<td>".$total.'€'."</td>";
    	  echo "<tr>";
    	  echo "<td><b><font size = 5>".'Commande de l\'adherent RFL n° '.$user_id."</b></br></td>"; 
    ?>
        </tbody>
      </table>

      <!--<p class="text-right">
        <div id="paypal-button"></div>
        <!--<a href="payment.php" class="btn btn-success">Acheter</a>-->
      </p>

    </div><!-- /.container -->

      <script
        src="https://www.paypal.com/sdk/js?client-id=client-id&currency=EUR"> // Required. Replace SB_CLIENT_ID with your sandbox client ID.

        paypal.Buttons().render('#paypal-button-container');

        // This function displays Smart Payment Buttons on your web page.
    	</script>
    <center>	
      <div id="paypal-button-container"></div> 
      </center>
      <script>
      paypal.Buttons({
        createOrder: function(data, actions) {
          return actions.order.create({
            purchase_units: [{
              amount: {
                value: <?php echo $total ;?>  //'5.60'
              }
            }]
          });
        },
        onApprove: function(data, actions) {
          return actions.order.capture().then(function(details) {
            alert('Transaction completed by adherent ' + details.payer.name.given_name);
            // Call your server to save the transaction
            return fetch('/paypal-transaction-complete', {
              method: 'post',
              headers: {
                'content-type': 'application/json'
              },
              body: JSON.stringify({
                orderID: data.orderID,
    			payerID: data.payerID
    			})
    			
            });
          });
        }
      }).render('#paypal-button-container');

      </script>

    </body>
    </html>

共1个答案

匿名用户

我解决了这个问题。Paypal提供的脚本无法工作,因为存在语法错误。他们对这些方法的解释非常模糊。最后,在做了一些语法和url修改之后,我的php IPN paypal IPN侦听器软件开始工作。

<?php

$charset = "utf-8";

include('../config/dbconn.php');
	$deb='je commence';
	mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$deb')");

/* NE RIEN MODIFIER CI-DESSOUS */

// lecture du post de PayPal et ajout de 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = trim(urlencode(stripslashes($value)));
$req .= "&$key=$value";
}

//mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$req')");

// reponse a PayPal pour validation
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
//$header .= "Content-Length: 1028\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.sandbox.paypal.com\r\n";
$header .= "Connection: close\r\n\r\n";
//$header .= "Host: ipnpb.paypal.com:443\r\n";

$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
//$fp = fsockopen ('ipnpb.paypal.com', 443, $errno, $errstr, 30);
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('fp1')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$fp')");

// variables
$discount = $_POST['discount'];
$insurance_amount = $_POST['insurance_amount'];
$payer_id = $_POST['payer_id'];
$address_country_code = $_POST['address_country_code'];
$ipn_track_id = $_POST['ipn_track_id'];
$address_zip = $_POST['address_zip'];
$charset = $_POST['charset'];
$payment_gross = $_POST['payment_gross'];
$address_status = $_POST['address_status'];
$shipping_discount = $_POST['shipping_discount'];
$address_street = $_POST['address_street'];
$verify_sign = $_POST['verify_sign'];
$item_name = $_POST['item_name'];
$test_ipn = $_POST['test_ipn'];
$txn_type = $_POST['txn_type'];
$receiver_id = $_POST['receiver_id'];
$payment_fee = $_POST['payment_fee'];
$mc_currency = $_POST['mc_currency'];
$transaction_subject = $_POST['transaction_subject'];
$shipping_method = $_POST['shipping_method'];
$custom = $_POST['custom'];
$protection_eligibility = $_POST['protection_eligibility'];
$address_country = $_POST['address_country'];
$payer_status = $_POST['payer_status'];
$first_name = $_POST['first_name'];
$address_name = $_POST['address_name'];
$mc_gross = $_POST['mc_gross'];
$payment_date = $_POST['payment_date'];
$payment_status = $_POST['payment_status'];
$quantity = $_POST['quantity'];
$business = $_POST['business'];
$item_number = $_POST['item_number'];
$last_name = $_POST['last_name'];
$address_state = $_POST['address_state'];
$txn_id = $_POST['txn_id'];
$mc_fee = $_POST['mc_fee'];
$payment_type = $_POST['payment_type'];
$notify_version = $_POST['notify_version'];
$payer_email = $_POST['payer_email'];
$receiver_email = $_POST['receiver_email'];
$address_city = $_POST['address_city'];
$residence_country = $_POST['residence_country'];

$payment_currency = $_POST['mc_currency'];
$receiver_id = $_POST['receiver_id'];
$num_cart_items = $_POST['num_cart_items'];


mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$txn_id')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('Date')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$payment_date')");
$rest = substr($payment_date, 9, 13);
$mois = substr($rest, 0, 3);
$jour = substr($rest, 4, 2);
$an = substr($rest, 8, 4);
$date = $an.'-'.$mois.'-'.$jour;
$date = date_create($date);
$dte = date_format($date,'Y-m-d');

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
fseek($fp, 0);
while (!feof($fp)) {
$res = fgets ($fp, 10024);
//$test=strcmp (trim($res), "VERIFIED");
//if (strcmp ($res, "VERIFIED") == 0) {
if (strcmp (trim($res), "VERIFIED") == 0) {
$deba = 'verifie';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$deba')");
// Envoi du mail
   
 	$paypal_sql = "INSERT INTO paiements (payment_id,payment_status,payment_amount,taxe_paypal,payment_currency,payment_date,payer_email)
    VALUES ('$txn_id','$payment_status','$mc_gross','$mc_fee','$mc_currency','$dte','$payer_email')";
    mysqli_query($dbconn,$paypal_sql); 


}
else if (strcmp (trim($res), "INVALID") == 0) {
$debb = 'invalide';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$debb')");

	$payment_status = 'INVALID';
 	$paypal_sql = "INSERT INTO paiements (payment_id,payment_status,payment_amount,taxe_paypal,payment_currency,payment_date,payer_email)
    VALUES ('$txn_id','$payment_status','$mc_gross','$mc_fee','$mc_currency','$dte','$payer_email')";
    mysqli_query($dbconn,$paypal_sql); 


}
}
fclose ($fp);
}
$debc = 'fini';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$debc')");
?>

 

相关问题


  • 如何使用Apache POI从excel表中检索日期
  • 检索动态ng模型的值时出错
  • 在heroku上部署Web应用程序时构建成功,但无法查看站点,因为我收到错误,请看下面的图片
  • javascript中有没有一种方法可以从数组中检索随机对象,并通过单击按钮将它们随机分配给divny?
  • JVM什么时候会在堆栈跟踪中省略行信息?我如何防止它?
  • 使用Kafka java生产者发送消息:生产者连接localhost:9092不成功
  • java和nlp提取信息(恶意软件名称)和过滤
  • 如何在hibernate中检索关系映射?
  • 如何仅检索 ID 而不是关联的实体?
  • Spring数据JPA是否找到所有从一对一映射中的关联表中检索数据?
  • 如何检索没有表注释的实体的映射数据源tableName?
  • Azure Devops发布管道-当某些阶段成功时运行此作业自定义条件
  • 授权代码在 C# PayPal REST API Winforms 应用中的位置如何?
  • 成功下单后清除回收器视图
  • Retrofit2 Android:检索嵌套数据(当前错误:预期BEGIN_ARRAY但在第1行第2列路径$处BEGIN_OBJECT)
  • 当遵循数据库优先方法时,使用[NotMapped]向视图传递额外信息
  • 在不丢失R [duplicate]中其他列的信息的情况下,取消列和拆分列以添加到行中
  • 为什么不完整的开关表达式能够成功编译
  • 没有错误详细信息的数据表ajax错误
  • jquery ajax总是抛出错误(永远不会成功)

共有3个答案

阴靖
2023-03-14
热门标签
郎星汉
2023-03-14
相关问题
苏选
2023-03-14

我解决了这个问题。Paypal提供的脚本无法工作,因为存在语法错误。他们对这些方法的解释非常模糊。最后,在做了一些语法和url修改之后,我的php IPN paypal IPN侦听器软件开始工作。

js prettyprint-override"><?php

$charset = "utf-8";

include('../config/dbconn.php');
	$deb='je commence';
	mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$deb')");

/* NE RIEN MODIFIER CI-DESSOUS */

// lecture du post de PayPal et ajout de 'cmd'
$req = 'cmd=_notify-validate';

foreach ($_POST as $key => $value) {
$value = trim(urlencode(stripslashes($value)));
$req .= "&$key=$value";
}

//mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$req')");

// reponse a PayPal pour validation
$header .= "POST /cgi-bin/webscr HTTP/1.1\r\n";
//$header .= "Content-Length: 1028\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Host: www.sandbox.paypal.com\r\n";
$header .= "Connection: close\r\n\r\n";
//$header .= "Host: ipnpb.paypal.com:443\r\n";

$fp = fsockopen ('ssl://www.sandbox.paypal.com', 443, $errno, $errstr, 30);
//$fp = fsockopen ('ipnpb.paypal.com', 443, $errno, $errstr, 30);
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('fp1')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$fp')");

// variables
$discount = $_POST['discount'];
$insurance_amount = $_POST['insurance_amount'];
$payer_id = $_POST['payer_id'];
$address_country_code = $_POST['address_country_code'];
$ipn_track_id = $_POST['ipn_track_id'];
$address_zip = $_POST['address_zip'];
$charset = $_POST['charset'];
$payment_gross = $_POST['payment_gross'];
$address_status = $_POST['address_status'];
$shipping_discount = $_POST['shipping_discount'];
$address_street = $_POST['address_street'];
$verify_sign = $_POST['verify_sign'];
$item_name = $_POST['item_name'];
$test_ipn = $_POST['test_ipn'];
$txn_type = $_POST['txn_type'];
$receiver_id = $_POST['receiver_id'];
$payment_fee = $_POST['payment_fee'];
$mc_currency = $_POST['mc_currency'];
$transaction_subject = $_POST['transaction_subject'];
$shipping_method = $_POST['shipping_method'];
$custom = $_POST['custom'];
$protection_eligibility = $_POST['protection_eligibility'];
$address_country = $_POST['address_country'];
$payer_status = $_POST['payer_status'];
$first_name = $_POST['first_name'];
$address_name = $_POST['address_name'];
$mc_gross = $_POST['mc_gross'];
$payment_date = $_POST['payment_date'];
$payment_status = $_POST['payment_status'];
$quantity = $_POST['quantity'];
$business = $_POST['business'];
$item_number = $_POST['item_number'];
$last_name = $_POST['last_name'];
$address_state = $_POST['address_state'];
$txn_id = $_POST['txn_id'];
$mc_fee = $_POST['mc_fee'];
$payment_type = $_POST['payment_type'];
$notify_version = $_POST['notify_version'];
$payer_email = $_POST['payer_email'];
$receiver_email = $_POST['receiver_email'];
$address_city = $_POST['address_city'];
$residence_country = $_POST['residence_country'];

$payment_currency = $_POST['mc_currency'];
$receiver_id = $_POST['receiver_id'];
$num_cart_items = $_POST['num_cart_items'];


mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$txn_id')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('Date')");
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$payment_date')");
$rest = substr($payment_date, 9, 13);
$mois = substr($rest, 0, 3);
$jour = substr($rest, 4, 2);
$an = substr($rest, 8, 4);
$date = $an.'-'.$mois.'-'.$jour;
$date = date_create($date);
$dte = date_format($date,'Y-m-d');

if (!$fp) {
// HTTP ERROR
} else {
fputs ($fp, $header . $req);
fseek($fp, 0);
while (!feof($fp)) {
$res = fgets ($fp, 10024);
//$test=strcmp (trim($res), "VERIFIED");
//if (strcmp ($res, "VERIFIED") == 0) {
if (strcmp (trim($res), "VERIFIED") == 0) {
$deba = 'verifie';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$deba')");
// Envoi du mail
   
 	$paypal_sql = "INSERT INTO paiements (payment_id,payment_status,payment_amount,taxe_paypal,payment_currency,payment_date,payer_email)
    VALUES ('$txn_id','$payment_status','$mc_gross','$mc_fee','$mc_currency','$dte','$payer_email')";
    mysqli_query($dbconn,$paypal_sql); 


}
else if (strcmp (trim($res), "INVALID") == 0) {
$debb = 'invalide';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$debb')");

	$payment_status = 'INVALID';
 	$paypal_sql = "INSERT INTO paiements (payment_id,payment_status,payment_amount,taxe_paypal,payment_currency,payment_date,payer_email)
    VALUES ('$txn_id','$payment_status','$mc_gross','$mc_fee','$mc_currency','$dte','$payer_email')";
    mysqli_query($dbconn,$paypal_sql); 


}
}
fclose ($fp);
}
$debc = 'fini';
mysqli_query($dbconn,"INSERT INTO paytest (mess) VALUES ('$debc')");
?>

 
 类似资料:
  • 当你设置PayPal Buy Now按钮时,你可以在客户结账后将他们带到URL。 有没有办法使用在PayPal结帐后立即检索他们的PayPal电子邮件? PayPal在感谢页面末尾附加某种email@address.com吗? 或者,在PayPal中键入成功URL时,我可以在我的感谢页面末尾添加任何变量吗? 基本上,我想存储他们在存款时使用的PayPal电子邮件地址,这样当他们兑现时,将使用相同的

  • 我正在使用本教程:https://www.nodejsera.com/paypal-payment-integration-using-nodejs-part2.html 它实现PayPal的方式是: 然后相应地重定向用户: 我正在使用Sandbox,并且虚拟支付成功。付款完成后,我想向买家(在这种情况下是我自己)发送一封电子邮件。如何检索该信息(如果付款正常,用户电子邮件和姓名等)? 并且,有没

  • 在用户批准后执行()授权支付时失败。 范围:"openid配置文件电子邮件地址电话https://uri.paypal.com/services/expresscheckout" consent _ uri:" https://www . sandbox . paypal . com/web apps/auth/protocol/OpenID connect/v1/authorize?客户端标识=

  • 我已经成功地利用PayPal PHP SKD请求付款,将用户发送到PayPal支付网关沙箱,并提供凭据和沙箱买家帐户等。一切正常,我收到一个返回URL的请求,其中包含$_GetVariables success=true、paymentID、token和PayerID。我的问题是在下一步中,它捕获paymentID和PayRid,为PaymentExecution创建对象,它似乎工作正常,但在执行

  • 我正在开发一个WordPress插件,在那里我可以接受PayPal Express的付款。我能够成功获得PaymentID和PayerID。但我不知道如何验证付款。另外,我可以从payerID或PaymentID获取付款人详细信息吗? 下面是我用来创建支付按钮的脚本。 非常感谢。