Jump to content
Larry Ullman's Book Forums

Paypal Integration Confusion


Recommended Posts

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

  • 2 weeks later...

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

 Share

×
×
  • Create New...