【问题标题】:PayPal and User payment system贝宝和用户支付系统
【发布时间】:2012-09-04 09:55:20
【问题描述】:

我正在使用 PayPal Sandbox 玩一些电子商务的东西。到目前为止,这是应用程序的流程:

  • 用户登录,服务器将 user_id 存储在数据库的会话中。登录后,用户可以单击立即购买按钮。将他们带到贝宝,他们登录并付款,IPN 收到通知罚款:)

我现在想要扩展它的唯一一件事是创建远离接收 users_id 的 IPN,这样我就可以在他们的数据库条目上设置一个标志。这可以在 PayPal 中完成吗?

我已经尝试了以下视图:

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

感谢您的帮助:)

【问题讨论】:

    标签: php paypal e-commerce


    【解决方案1】:
    <input type="hidden" name="custom" id="custom" value="<?php echo $user_id;?>"/>
    

    您的 IPN 将收到 $_POST['custom'] 变量中的用户 ID。

    如果您想将多个值传递给 Paypal 并返回到您的 IPN:

        <script type="text/javascript">
              // using prototype
          function checkCustom(){
            var custom1 = $F('custom1');
            var custom2 = $F('custom2');
            $('custom').value = '{"userID":"'+ custom1 +'","publicDonation":"'+ custom2 +'"}';
    
          }
        </script>
    <input type="hidden" name="custom1" id="custom1" value="<?php echo $user_id;?>"/>
    <input type="hidden" name="custom2" id="custom2" value="<?php echo $user_email;?>"/>
    

    欲了解更多信息,请查看贝宝 IPN:

    自定义

    由您(商家)传递的自定义值。这些是通过 从未呈现给客户的变量长度:255 字符

    https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_IPNandPDTVariables#id091EAB0105Z

    【讨论】:

      猜你喜欢
      • 2015-06-25
      • 2015-05-13
      • 1970-01-01
      • 1970-01-01
      • 2016-05-18
      • 1970-01-01
      • 2013-09-21
      • 2013-07-09
      • 2013-02-20
      相关资源
      最近更新 更多