paypal ipn 传递参数
我想在用户付款后从 paypal 获取用户 ID。
Pay.php
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $merchant_email ?>">
<input type="hidden" name="item_name" value="IPN test">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="notify_url" value="<?php echo $ipn_url ?>">
<input type="hidden" name="return" value="<?php echo $return_url ?>">
<input type="hidden" name="cancel_return" value="<?php echo $cancel_url ?>">
<input type="hidden" name="userid" value="888">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif"
border="0" name="submit" alt="Buy Now">
所以我会在我的 paypal 帐户中启用 ipn 并指向 http://www.domain.com /ipn.php?
ipn.php 中的代码
<?php
$userid = $_POST['userid'];
$qry = "INSERT into mypayments(userid) VALUES ('$userid') “;
$result = mysql_query($qry,$db);
?>
是否正确?我如何从 paypal 获得验证?
I wanted to get the userid from paypal after the user have made his payment.
Pay.php
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="<?php echo $merchant_email ?>">
<input type="hidden" name="item_name" value="IPN test">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="0.01">
<input type="hidden" name="notify_url" value="<?php echo $ipn_url ?>">
<input type="hidden" name="return" value="<?php echo $return_url ?>">
<input type="hidden" name="cancel_return" value="<?php echo $cancel_url ?>">
<input type="hidden" name="userid" value="888">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif"
border="0" name="submit" alt="Buy Now">
So I would enable ipn in my paypal account and point to http://www.domain.com/ipn.php?
In ipn.php code
<?php
$userid = $_POST['userid'];
$qry = "INSERT into mypayments(userid) VALUES ('$userid') “;
$result = mysql_query($qry,$db);
?>
Is it correct? How do I get VERIFIED from paypal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为 userid 是一个不正确的名称,不会在您的 IPN 消息中返回。我使用可选字段来传递 ID 以及处理交易所需的内容。
这些可选标签为自定义字段名称的 on0、on1 或 on3 以及 os0、ls1 和 os2 用于自定义字段值。这些值最高可达 on6 和 os6。
我将发送值为“UserID”的 on0 和实际 ID 的 os0 。
这些值将在 IPN 中表示如下:
os0 表示为 option_selection1
os1 表示为 option_selection2
< strong>os2 表示为 option_selection3
on0 表示为 option_name1
on1 表示为 >option_name2
on2 表示为 option_name3
这是有关 PayPal HTML 参数的信息
I believe that userid is an incorrect name and will not be returned in your IPN message. I use the optional fields for passing IDs and stuff needed for processing the transaction on my end.
These optional tags are on0, on1, or on3 for the custom field names and os0, ls1, and os2 for the custom field values. These values can go up to on6 and os6.
I would send on0 with a value of "UserID" and os0 the actual ID.
These values will be represented in the IPN as follows:
os0 is represented as option_selection1
os1 is represented as option_selection2
os2 is represented as option_selection3
on0 is represented as option_name1
on1 is represented as option_name2
on2 is represented as option_name3
Here's the info on PayPal's HTML parameters
使用“自定义”变量。
Use the "custom" variable.
这是一个两步过程。
PayPal 会将 IPN 发布到您在
$ipn_url
中指定的网址。当您使用附加的
cmd=_notify-validate
参数发布所有 IPN 数据时,您将收到VERIFIED
响应 (详细信息)返回 PayPal。PHP 示例。
Its a two step process.
PayPal will post an IPN to the url you specified in
$ipn_url
.You will then get a
VERIFIED
response when you post all of the IPN data with an additionalcmd=_notify-validate
param (details) back to PayPal.PHP sample here.