【问题标题】:Paypal subscription "custom" variable issue ( Sandbox )贝宝订阅“自定义”变量问题(沙盒)
【发布时间】:2015-10-26 19:25:21
【问题描述】:

所以我从他们的按钮模板创建者创建了一个贝宝按钮,我需要向他们发送一个包含用户 ID 的自定义变量。

所以我可以使用它来进一步识别用户并更新他们的特定记录

但是,paypal 给出的按钮模板

                    <form action="https://www.sandbox.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="CVWJZN5AALBVJ">
                    <input type="image" src="https://www.sandbox.paypal.com/en_US/GB/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.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
                    </form>

我把它改成了:

 <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
                    <input type="hidden" name="custom" value="<?php echo $id; ?>">
                    <input type="hidden" name="cmd" value="_s-xclick">
                    <input type="hidden" name="hosted_button_id" value="CVWJZN5AALBVJ">
                    <input type="image" src="https://www.sandbox.paypal.com/en_US/GB/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.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
                    </form>

基本上只是添加这一行

 <input type="hidden" name="custom" value="<?php echo $id; ?>">

但是当我的 IPN 被调用时,我做了一个 var 转储,并且自定义变量 与其他帖子变量一起发送

这是我通过订阅付款时收到的数据(来自 var 转储)

Array
(
    [txn_type] => subscr_signup
    [subscr_id] => I-TUUWHD0V6T4Y
    [last_name] => buyer
    [residence_country] => GB
    [mc_currency] => GBP
    [item_name] => premium membership
    [business] => dddd-facilitator@hotmail.com
    [recurring] => 1
    [address_street] => 1 Main Terrace
    [verify_sign] => AStwKS3.L4rNUPfkl7TOO9eahVmAABKWlAKqXwDrHAOGmGfwPvaWdtSg
    [payer_status] => verified
    [test_ipn] => 1
    [payer_email] =>dddd-buyer@hotmail.com
    [address_status] => confirmed
    [first_name] => test
    [receiver_email] => dddd-facilitator@hotmail.com
    [address_country_code] => GB
    [payer_id] => 7RUAE8WJDD4V2
    [address_city] => Wolverhampton
    [reattempt] => 1
    [address_state] => West Midlands
    [subscr_date] => 12:42:12 Oct 26, 2015 PDT
    [btn_id] => 3228524
    [address_zip] => W12 4LQ
    [charset] => windows-1252
    [notify_version] => 3.8
    [period3] => 1 M
    [address_country] => United Kingdom
    [mc_amount3] => 10.00
    [address_name] => test buyer
    [ipn_track_id] => 21e04b9a73c5
)

我想看[custom] =&gt; "usersid" 有什么指点吗?

【问题讨论】:

  • 也许这是一个问题,因为按钮是由他们托管的。您是否尝试过使用自定义按钮而不是托管按钮?这是一个自定义结帐按钮的示例:pastebin.com/VCaK4dtu(注意:该代码是我在我的一个电子商务网站上使用的结帐按钮代码的修改版本。)
  • @SpencerDoak 感谢您的回复,我找到了问题!

标签: php forms paypal paypal-ipn


【解决方案1】:

问题是数据库中的 ID 列是大写的:

我有

$id = $row['id'];

应该是什么时候

$id = $row['ID'];

【讨论】:

    【解决方案2】:

    问题是您使用了一个由 paypal 生成的按钮(id 为 CVWJZN5AALBVJ)! 此按钮提交您在 paypal 管理中作为参数添加的内容,而不是您在按钮表单中添加的参数。您必须使用自定义表单提交以下示例:

    <form method="post" name="checkout-form" action="https://www.paypal.com/cgi-bin/webscr">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="your@paypal_email.com">
    <input type="hidden" name="item_name" value="Product Name>
    <input type="hidden" name="amount" value="22" >
    <input type="hidden" name="item_number" value="65">
    <input type="hidden" name="custom" value="YOUR PRODUCT ID OR SOME CUSTOM CODE">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="quantity" value="1">
    <input type="hidden" name="no_shipping" value="1">
    <input type="hidden" name="return" value="http://zoomthe.me/paypalipn/paypal_ipn.php">
    <input type="hidden" name="cancel_return" value="http://zoomthe.me/paypal_cancel">
    <input type="hidden" name="cbt" value="Product Description">
    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="notify_url" value="http://zoomthe.me/your_listener_ipn_file.php">
    </form>
    

    【讨论】:

    • 不是我想要的,但感谢您的评论
    猜你喜欢
    • 2011-10-08
    • 2013-03-08
    • 2016-07-29
    • 2014-11-21
    • 2011-08-02
    • 2017-11-22
    • 2015-01-05
    • 2012-10-12
    • 2016-05-29
    相关资源
    最近更新 更多