【发布时间】:2017-06-30 19:37:32
【问题描述】:
我正在尝试在 paypal paynow 按钮中发送直通数据,当用户在付款后单击“返回商家”按钮时,让 paypal 将该数据返回到我的 php 页面。
为此,我使用了 paypal 按钮中的“return”功能,并与 rm=2 一起将所有数据作为 post 发回。但是,我无法让它工作。这是我的贝宝按钮 html:
<form name="paypal2" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxx">
<input type="hidden" name="invoice" value="testinvoice_fromcode2">
<input type="hidden" name="custom" value="testcustom_fromcode1">
<input type="hidden" name="on0" value="yes"><!--agreetc-->
<input type="hidden" name="os0" value="<?php echo $aid; ?>">
<input type="hidden" name="on1" value="<?php echo $id; ?>">
<input type="hidden" name="os1" value="<?php echo $agent; ?>">
<input type="hidden" name="return" value=http://www.example.com/Admin/conpanel/privat/phpvendorpaidad.php>
<input type="hidden" name="rm" value="2">
<input id="submit" type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
在 IPN 通知中,paypal 呈现: os0 作为 option_selection1, os1 作为 option_selection2, on0 作为 option_name1, on1 作为 option_name2,
我知道 on0 和 os0 应该用作名称值对,但早在 2009 年我第一次编写此脚本时,只允许 2 个集合,因此我使用所有 4 个来携带值,然后它就可以工作了。
但本质上,我不明白为什么
<input type="hidden" name="return" value=http://www.example.com/Admin/conpanel/privat/phpvendorpaidad.php>
<input type="hidden" name="rm" value="2">
不工作。
我无法在接收脚本 phpvendorpaidad.php 中获取这些值
$aid=$_REQUEST['option_selection1'];
或作为
$aid=$_REQUEST['os0'];
例如。
谁能看到我做错了什么?非常感谢。
我还有一个正常工作的 IPN 侦听器页面。另一种方法是使用 javascript 将其构建到 IPN 侦听器页面中,以便在页面加载时自动发送表单数据?
【问题讨论】: