【发布时间】:2019-09-12 00:45:25
【问题描述】:
我有一个带有设置订阅按钮的 Paypal 帐户。在买家设置订阅后,我会将他发送到收据页面。在此页面上,我需要从 Paypal 检索变量以通过数据库进行更新。
- 表单正在运行
- 订阅保存在 Paypal 上
- 买家正确重定向到收据页面
但未检索到变量。
这是我迄今为止尝试过的:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="mybusinessname">
<input type="hidden" name="lc" value="IE">
<input type="hidden" name="item_name" value="Monthly Subscription">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="a1" value="0.00">
<input type="hidden" name="p1" value="1">
<input type="hidden" name="t1" value="M">
<input type="hidden" name="src" value="1">
<input type="hidden" name="a3" value="1.50">
<input type="hidden" name="p3" value="1">
<input type="hidden" name="t3" value="M">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="bn" value="PP-SubscriptionsBF:btn_subscribeCC_LG.gif:NonHosted">
<input type="hidden" name="custom" value="test_value">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_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_US/i/scr/pixel.gif" width="1" height="1">
</form>
Paypal 上的即时付款通知 (IPN) 详细信息已启用并指向:
https://www.mydomain/payments/
IPN 历史显示来自 Paypal 的通知已正确发送到通知 URL(上)
但是,收据页面显示
Error
Undefined index: custom
为了获得自定义变量,我尝试了 GET、POST 甚至 REQUEST 方法,使用类似
test 1: <?php echo $_GET["custom"]; ?>
test 2: <?php echo $_POST["custom"]; ?>
然后我尝试了
<?php
if (isset($_POST['custom'])) {
$custom_display = $_POST['custom'];
}
?>
但这会导致:Undefined variable: custom_display
我只需要获取自定义变量。
我猜我做错了什么,但经过数小时搜索答案并尝试不同的设置(例如,在表单中发送动态通知 url、更改 paypal 中的设置、使用不同的 url 等)似乎什么都没有为我工作,我被困住了
任何帮助将不胜感激!
【问题讨论】:
-
也许堆栈跟踪可能有帮助?
标签: button dynamic paypal paypal-ipn subscription