Passing price variable to PayPal with custom button

前端 未结 8 1050
长情又很酷
长情又很酷 2020-12-07 21:26

I have a form and a custom PayPal button, but how do I pass the value/price variable to PayPal?

8条回答
  •  伪装坚强ぢ
    2020-12-07 21:52

    Here is the 2013 version: Go to create a button, when you get to step 2, uncheck the box, proceed to step 3 then create the button. Once you have the code, it will look like this:

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    Your "business" value will not be XXXXXXXX, so make sure you leave the one Paypal gives you. You can also set your cancel and return URL's.

    For more advanced PHP users: I actually setup a PHP string and it works great! For example, see below:

     https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&businesss=XXXXXXXXX&lc=US&item_name=$mydescription&amount=$myprice&........
    

    And so on.....As you can see $mydescription is a PHP variable and $myprice is a PHP variable. What I did was setup a HTML form to collect data and used that form as a payment processing form. Once the user clicks submit, I have it going to a PHP page to use as a Mailer, Database Insertion, Autoresponder, and finally a Header redirect. The URL for the redirect is the Paypal URL with the Variables in the string! This thread actually helped me find the correct Paypal button code so that string will work properly with price variations! FYI - If you are a beginner PHP person, the image field is not used in the string. Only the URL and then the Hidden Names and Values.

提交回复
热议问题