Jump to content

Sending shopping cart to Paypal


tomccabe

Recommended Posts

Im just finishing up the front end to a client's shop who only has (and wants) to use Paypal as a payment method. I've never had to work with Paypal for multiple items and want to know if there's a tried and true method of doing this.

 

My setup does all the shipping info and cart population (the items in the cart are in a $_SESSION array) what I would like to do is send my items into a Paypal shopping cart in which the items are individually shown with quantity, individual price, total price per item and total cart price with the payment option.

 

I know about the Paypal IPN and figure this is part of the solution, but is there a common method for doing the above? I've found solutions for a single item. My workaround thought was to have the client make her Paypal "buttons" but just store the code in her products database with the rest of the info and store them as hidden input fields that shoot off to Paypal all at once. I wonder if this is even possible?

 

I've tried to wade through Paypal's dev site but it's poorly laid out and I can't seem to find an answer. 

Link to comment
https://forums.phpfreaks.com/topic/198827-sending-shopping-cart-to-paypal/
Share on other sites

If you have your own shopping cart programmed, the easiest way to post items to PayPal is: on the checkout screen of your shopping cart, have a form with hidden fields for each item in cart and button "Pay with PayPal..."

When user press this, they will get directly to PayPal payment screen with all the individual shopping cart items.

Here is example of such form:

 

<form method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input type="hidden" name="business" value="your@paypal.com">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="return" value="http://your.com/thankyou.php">
<input type="hidden" name="cancel_return" value="http://your.com/store">

<input type="hidden" name="item_name_1" value="Product name #1">
<input type="hidden" name="item_number_1" value="ID01">
<input type="hidden" name="quantity_1" value="1">
<input type="hidden" name="amount_1" value="34.95">

<input type="hidden" name="item_name_2" value="Product name #2">
<input type="hidden" name="item_number_2" value="ID02">
<input type="hidden" name="quantity_2" value="1">
<input type="hidden" name="amount_2" value="10.00">

<input type="submit" name="pp" value="Pay with PayPal...">
</form>

 

Somewhere on PayPal.com there was a guide on third party shopping cart integration, but I can't find it now.

This is sort of what I'm looking to do, but with a multiple item cart:

 

http://net.tutsplus.com/tutorials/php/using-paypals-instant-payment-notification-with-php/

 

I'll try to look for some more info I guess, but I figure I'm certainly not the first person to want to do this.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.