所以我已经将这个未经测试的代码添加到我的IPN
if (strcmp ($res, "VERIFIED") == 0) {
// check whether the payment_status is Completed
// check that txn_id has not been previously processed
// check that receiver_email is your PayPal email
// check that payment_amount/payment_currency are correct
// process payment and mark item as paid.
// assign posted variables to local variables
$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];
include 'connect.php';
if($payment_status == "completed")
{
mysql_query('UPDATE `users` SET `is_member`= 1 WHERE `username` == $username')
}
else
{
mysql_query('UPDATE `users` SET `is_member`= 0 WHERE `username` == $username')
}
基本上根据payment_status更改数据。我遇到的问题是,paypal不知道用户名是什么。我如何向paypal提供此信息?我是通过订阅按钮或更改HTML代码吗?
答案 0 :(得分:1)
此处有几个选项可用于完成与IPN的用户/成员资格核对,
$payer_email
并使数据与您的数据库条目匹配(订单详情)< / LI>
醇>
虽然这需要对代码进行最少的更改,但当用户使用其他电子邮件帐户(PayPal帐户)付款时,它将无法正常工作
$invoice
值并将其与您的订单数据条目一起映射。有些参考资料可供参考:
点击此处查看如何添加“发票”字段:
对于标准付款按钮,请参阅HTML Variables for PayPal Payments Standard
对于Express Checkout API,请参阅SetExpressCheckout API Operation (NVP)