Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts

    PayPal buy buttons for more than one item?

    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.
    Leonard Whistler

  • #2
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    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, starting on page 127.

    Hope this helps…

  • #3
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.



    PHP Code:
    <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
    Last edited by Len Whistler; 09-15-2007 at 02:24 AM.
    Leonard Whistler

  • #4
    Senior Coder
    Join Date
    Nov 2003
    Location
    Minneapolis, MN
    Posts
    2,879
    Thanks
    2
    Thanked 65 Times in 56 Posts
    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.

  • Users who have thanked rmedek for this post:

    Len Whistler (09-15-2007)

  • #5
    Senior Coder Len Whistler's Avatar
    Join Date
    Jul 2002
    Location
    Vancouver, BC Canada
    Posts
    1,323
    Thanks
    26
    Thanked 100 Times in 100 Posts
    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.
    Leonard Whistler

  • #6
    New Coder
    Join Date
    Jul 2010
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts

    See pay pal integration blog



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •