Paypal隐藏HTML代码

I am trying to hide my HTML code for the buy option with PayPal.

I have taken code from : https://github.com/Quixotix/PHP-PayPal-IPN.

<form name="_xclick" action="https://www.sandbox.paypal.com/cgi-bin/webscr" 
    method="post">
    <input type="hidden" name="cmd" value="_xclick">
    <input type="hidden" name="business" value="YOUR SANDBOX SELLER EMAIL">
    <input type="hidden" name="currency_code" value="USD">
    <input type="hidden" name="item_name" value="Digital Download">
    <input type="hidden" name="amount" value="9.99">
    <input type="hidden" name="return" value="THIS URL">
    <input type="hidden" name="notify_url" value="THE URL TO YOUR ipn.php SCRIPT">
    <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_buynow_LG.gif" 
        border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>

I have a few things to fix in this...

  • I want to hide this HTML code for the buy option.
  • I also want to add userid in this code <input type="hidden" name="userid" value="2"> but it didn't work for me

I just want something like a simple button and the rest thing goes inside the PHP file and takes the user to the PayPal site. I know it's not safe using this codes since the user knows the ipn.php location and a hacker may attack.

I have added many functions in this tutorial and it's working fine in the sandbox

The problem is that I'm not able to send the userid and read it in my ipn.php

PS: If there is better tutorial than this, that would help me a lot. Thanks. I am working with PayPal for the first time.

Thanks

Instead of using form tag in html page. you can also set all values from .php file and can redirect on click of pay button. I mean that to create form tag for paypal at run time from php code.

and also for set userid paypal has some rules and according to that paypal allows only predefined variables so to pass userid you can use

<input type="hidden" value="Order Number:" name="on0" />
<input type="hidden" name="os0" id="os0" value="2" />

These are additional parameters that paypal allow to use as per our need. try this.