...

View Full Version : PayPal buy buttons for more than one item?



Len Whistler
09-14-2007, 11:18 PM
The PayPal "Buy Now" "Make a Donation" and "Add to Cart" buttons all work the same way, only one item at a time can be submitted. Anyway to have it so that multiple items can be sent at the same time with one button? I have already created a cart and do not want to set up a PayPal shopping cart, I just want a PayPal button that will send all the data from my shopping cart to PayPal.

I have a demo button set up at: http://www.rgbpixels.ca/paypal_test.htm If you click the "Buy Now" button only one item is listed. I want more than one row of items, but can't figure out how to code the button.

rmedek
09-15-2007, 12:32 AM
Hi Len,

The trick is, I've found, to code a shopping cart that sends the items to PayPal and integrates with its shopping cart. In other words, you build a cart in whatever scripting language you prefer and have it track items like "item_1", "item_2", etc.; then once the user submits it, it populates the PayPal shopping cart with that info.

It sounds more confusing than it is, and it's pretty seamless on the user end. Take a look at a cart I hand-built here:

http://sommertimegifts.com/cart/

or here:

http://dreamflightsballooning.com/purchase

and you'll see how it was put together. Essentially I'm just following instructions on the Web Payments Standard Integration Guide (https://www.paypalobjects.com/WEBSCR-480-20070913-2/en_US/pdf/PP_WebsitePaymentsStandard_IntegrationGuide.pdf), starting on page 127.

Hope this helps…

Len Whistler
09-15-2007, 03:21 AM
rmedek....Thanks for the reply. I found the solution from the forum at http://www.paypaldev.org

I don't want to use PayPal's shopping cart, I only want a completed order sent to PayPal after my cart has been used. Below is the code I had in mind and with a PHP foreach loop I can pass on 1 item or 50 items to PayPal with one button.





<html>
<body>
<form action="https://www.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="test_button@gmail.com">
<input type="hidden" name="item_name_1"
value="Item Name 1">
<input type="hidden" name="amount_1" value="1.00">
<input type="hidden" name="item_name_2"
value="Item Name 2">
<input type="hidden" name="amount_2" value="2.00">
<input type="submit" value="PayPal">
</form>
</body>
</html>

rmedek
09-15-2007, 04:15 AM
No problem. Just for the record, you are using PayPal's shopping cart—the difference is you are pre-populating it with items rather than initially entering items onto it, just like the examples I showed you. That's what the <input type="hidden" name="cmd" value="_cart"> sets up.

Anyways, glad you got it working. :)

Len Whistler
09-15-2007, 07:06 AM
rmedek....I just finished checking out your cart at Sommertime Gifts and that's exactly what I had in mind, looks like you use $_SESSION to keep track of items added during the users visit. I am also setting up a money order option using http://www.fpdf.org to generate PDF invoices with PHP.

rleahong
03-30-2013, 05:03 PM
see http://rleahongpaypalintegrate.blogspot.com



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum