The Paypal interface has been poorly handled here before, so I want something useful to me and others. The basic <FORM> I will post below. I am storing the data in sessions, which came from a database.
Paypal says to send your order in a form, which they present for payment. Not interested in giving them all the details of an order, instead, we are going to use Paypal's first option --
Method 1. Passing the Aggregate Cart Amount to PayPal
(
https://www.paypal.com/us/cgi-bin/webscr?cmd=p/pdn/howto_checkout)
I need help formatting the "aggregate Cart" with PHP and database fields, or in my case, session data. We need to make the Item (their t-shirt example) read :
"Your order of <date> for <X> Items from <site>, Total Order Cost <$amount>.
To do this:
1. The <date> needs to be gotten from the server and presented like -- May 16, 2005
2. The site could be hard coded, but I would like to extract "
www.thissite.com" from the URL itself.
3. The <X> quantity is the number of items in the PHP session, which is the "key" in this statement --
foreach($_SESSION['divs'] as $key => $val)
In that loop we will:
(a) add the number of items, which will .$_SESSION['divs'][$key]['
qty']., convert to a character
(b) add up the <$amount> from each item, $_SESSION['divs'][$key]['p
rice'] times the qty above
(c) total and convert $amount to 2 decimal places
(d) take the value of shipping returned from a javascript function Calc_ship(), say call it 'totship'
(e) add to total price in B above, to get order total, but split each into the form going to Paypal.
Take your time with this code, it has not been done this way before in this section, AFAIK.
Start Free Trial