我正在为一个我正在努力构建的在线商店尝试使用PayPal-sandbox。按照目前的情况,购买者只需选择一种产品,单击“立即购买”按钮,然后发送到PayPal完成交易。
之后,我有一个函数利用返回的url将事务详细信息存储在我的orders表中。

一切正常,但我想知道,是否也有可能捕获的买家姓名和送货地址从PayPal表单使用返回的网址。
function process_transaction() {
if(isset($_GET['tx'])) { // ie. if transaction sale has been completed....
$amount = $_GET['amt']; // get amount details for our db
$currency = $_GET['cc'];
$transaction = $_GET['tx']; // get transaction details and we will bump into our db
$status = $_GET['st']; // get status, ie completed
$total = 0; // default product total variables set to zero in the first instance
$item_quantity = 0; // default quantity variable set to zero
$send_order = query(" INSERT INTO orders (order_amount, order_transaction, order_status, order_currency) VALUES('{$amount}','{$transaction}','{$status}','{$currency}')");
confirm($send_order);
$last_id = last_id();
foreach ($_SESSION as $name => $value) {
if($value > 0 ) {
if(substr($name, 0, 8) == "product_") {
$length = strlen($name) - 8;
$id = substr($name, 8 , $length);
$query = query(" SELECT * FROM products WHERE product_id = " . escape_string($id). " " );
confirm($query);
while ($row = fetch_array($query)) {
$product_price = $row['product_price'];
$sub = $row['product_price']*$value;
$item_quantity +=$value;
$insert_report = query(" INSERT INTO reports (product_id, order_id, product_price, product_quantity) VALUES('{$id}','{$last_id}','{$product_price}','{$value}')");
confirm($insert_report); //runs the confirm helper method
} // end of while loop
$total += $sub;
echo $item_quantity;
} // end of substring if statement
}
}
session_destroy();
} else {
redirect("index.php");
}
} 发布于 2018-11-24 23:32:22
您添加到您的数据库的信息是来自网址字符串,如您所说,使用PHP $amount = $_GET['amt']等。您的买家的姓名和所有其他信息将必须以相同的方式进行解析,如果它包含在该字符串中,例如,以"&customer_name=firstname_lastname“的形式。
不过,我的猜测是,它不会成为现实。以这种方式传输任何敏感数据都是完全不安全的。
您必须从其他来源获取客户信息。你应该无论如何都会得到它,因为你将不得不在你的网上商店在某一点上收集它。
https://stackoverflow.com/questions/53459135
复制相似问题