【问题标题】:Building a custom PayPal return URL before POST在 POST 之前构建自定义 PayPal 返回 URL
【发布时间】:2014-11-08 14:46:05
【问题描述】:

我有一个 PayPal 按钮表单,我需要从表单数据生成 返回 URL。我正在寻找有关通过以下示例完成此任务的好方法的建议:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<?php 
$Fname = $_POST["first_name"];
$Lname = $_POST["last_name"];
?>
<input type="text" name="first_name" value="">    
<input type="text" name="last_name" value="">
<?php
$fullname = $Fname . " " . $Lname;
$urlstring = "http://somedomain.com/someapp.php?fullname=" . $fullname;
?>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" NAME="address_override" VALUE="1">
<input type="hidden" NAME="return" VALUE="<?php echo $urlstring; ?>">
<input type="hidden" name="hosted_button_id" value="aaabbbcccdddeee">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_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"></p>
</form>

有人吗?

【问题讨论】:

  • 你在这里遇到什么问题??

标签: php forms button paypal


【解决方案1】:

您需要先在您的 paypal 帐户中启用“自动退货”选项。

然后只需在表单中添加所需的 url 即可

    <input type="hidden" name="return" value="https://www.yoursite.com/checkout_complete.php">

如果您想获得有关交易的更可靠信息,您还应该使用将发送的 notify url 参数

    <input type="hidden" name="notify_url" value="https://www.yoursite.com/ipn.php">

更多信息在这里:https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside 在这里:https://www.paypal.com/cgi-bin/webscr?cmd=p/mer/express_return_summary-outside

【讨论】:

  • 我已经启用它并且一切正常,除了在事务完成后它返回到 $urlstring 中设置的 url 而没有 var $fullname。问题是直到 POST 才从表单输入中分配 var,这为时已晚。我需要在 POST 之前构建 $urlstring var。有什么想法吗?
猜你喜欢
  • 2022-09-20
  • 2013-05-26
  • 2012-12-12
  • 2018-11-01
  • 2014-01-09
  • 2014-04-19
  • 2016-10-18
  • 2014-07-28
  • 2021-05-19
相关资源
最近更新 更多