php - Paypal 订阅 "custom"变量问题(沙盒)

标签 php forms paypal paypal-ipn

所以我从他们的按钮模板创建者那里创建了一个 paypal 按钮,我需要向他们发送一个包含用户 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 转储并且自定义变量没有与其他 post 变量一起发送

这是我在订阅付款时收到的数据(来自 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] => "usersid" 有什么指点吗?

最佳答案

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

我有

$id = $row['id'];

应该在什么时候

$id = $row['ID'];

关于php - Paypal 订阅 "custom"变量问题(沙盒),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33353973/

相关文章:

paypal - 隐藏/删除使用借记卡或信用卡付款

php - php中的字符串类型大小写,是字符串还是字符串?

php - 从一个表单插入多条记录

php - 在 OmniPay 中获取 PayPal Rest 错误

forms - React - 预填充表单

javascript - 单击输入后删除输入错误消息

json - Swift PayPal MassPay post 调用失败。谁能指出我正确的方向

php - ldap_set_rebind_proc() 函数在任何 PHP Windows 发行版中都不起作用

javascript - 倒数计时器显示错误的给定日期和时间

php - 表达式引擎 - PHP - 无法运行函数