paypal ipn 传递参数

发布于 2024-09-02 22:14:09 字数 1328 浏览 3 评论 0原文

我想在用户付款后从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

何时共饮酒 2024-09-09 22:14:09

我认为 userid 是一个不正确的名称,不会在您的 IPN 消息中返回。我使用可选字段来传递 ID 以及处理交易所需的内容。

这些可选标签为自定义字段名称的 on0on1on3 以及 os0ls1 os2 用于自定义字段值。这些值最高可达 on6os6

我将发送值为“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

压抑⊿情绪 2024-09-09 22:14:09

使用“自定义”变量。

<input type="hidden" name="custom" value="user_id" />

Use the "custom" variable.

<input type="hidden" name="custom" value="user_id" />
话少情深 2024-09-09 22:14:09

这是一个两步过程。

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 additional cmd=_notify-validate param (details) back to PayPal.

PHP sample here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文