PayPal和用户支付系统


PayPal and User payment system

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

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

我现在唯一想做的就是扩展它,在IPN接收到users_id的情况下创建,这样我就可以在他们的数据库条目上设置一个标志。这可以在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>

感谢您的帮助:)

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

您的IPN将接收$_POST['custom']变量中的userID。

如果您想将多个值传递给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_ID=developer/e_howto_html_IPNandPDTVariables#id091EAB0105Z