another_noob Posted October 16, 2012 Share Posted October 16, 2012 First, thank you Larry for your great books. I really appriciate your "no nonsense" approach to presenting this complex material. I have learned a lot. I have also learned a lot from this forum. I have a general question about PayPal integration. I have built my site based mainly on the material in "PHP and MySQL for Dynamic Web Sites" with chapter 19 (E-Commerce example) helping me tie things together. I then bought the Effortless E-Commerce book hoping to integrate PayPal. I am stuck on how I send the values in my qty, sub-total, shipping, total etc.. variables to PayPal. The price of my goods vary immensly, so I can't use fixed price "buy it now" buttons. I just want a buyer to put the items in their cart, get a total with shipping (up to here it is all working great) click a PayPal button and have these values magically appear in PayPal and have the financial transaction completed at PayPal's site. I don't understand how I get that data to PayPal. I have a sandbox account to play in, but I can't find the answer at PayPal. Everywhere I look on-line I see the same advice, drop this PayPal HTML button code in and you are all set. Where does the transfer of data from my site to PayPal take place? I am missing something somewhere. I am not live and am running in localhost. I can't even get the sanbox to work with localhost, I never leave localhost when I click a PayPal button. Can someone explain to this noob how this works, i mean just in general? I hope this post makes sense. Thanks. Link to comment Share on other sites More sharing options...
rob Posted October 16, 2012 Share Posted October 16, 2012 Have a read through chapter 7: https://cms.paypal.c...rationGuide.pdf 1 Link to comment Share on other sites More sharing options...
another_noob Posted October 16, 2012 Author Share Posted October 16, 2012 Thanks for the reply and the link rob. I will study chapter 7 and the pdf. Maybe I am just overly complicating things in my head. I will step away for a day and re-attack the challenge with (hopefully) a clearer understanding. Thanks. Link to comment Share on other sites More sharing options...
another_noob Posted October 29, 2012 Author Share Posted October 29, 2012 After reading the PayPal manual chapter 7, I did get a better understanding, thanks for pointing me there. I am still a bit confused though. If I want to send my cart as an aggregate amount for example, I am supposed to use the following example HTML: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_cart"> <input type="hidden" name="upload" value="1"> <input type="hidden" name="business" value="seller@designerfotos.com"> <input type="hidden" name="item_name_1" value="Aggregated items"> <input type="hidden" name="amount_1" value="3.00"> <input type="submit" value="PayPal"> </form> This HTML works except I always am billing the buyer $3.00. If I put my PHP variable $total (which holds lets say 63.99) as value="$total" I get the following error returned from PayPal "The link you have used to enter the PayPal system contains an incorrectly formatted item amount." If I put literal dollar amount as value, like say 63.99, then everything works. How do I format a PHP variable to send the amount with this HTML? Thanks. Link to comment Share on other sites More sharing options...
MrJames Posted October 29, 2012 Share Posted October 29, 2012 Hi, Try the following as an example: <input type="hidden" name="amount" value=" ' . $productPrice . ' "> Regards 3 Link to comment Share on other sites More sharing options...
another_noob Posted October 29, 2012 Author Share Posted October 29, 2012 Thank you MrJames! That corrected the issue. It is now working great. I searched the vast internet and couldn't find the answer anywhere. Thank You MrJames and Thank You Larry for supporting your books so well. 1 Link to comment Share on other sites More sharing options...
Recommended Posts