PayPal Shopping Cart integration

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

PayPal Shopping Cart integration

Post by kaisellgren »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I have PayPal verified business account and two sandbox accounts.

I have own shoping cart in my site made with MySQL and PHP of course. However, when a customer has let's say 10 products in the cart and he presses Checkout, how do I make it so that those all products appear on PayPal Shopping Cart?

Right now I can do it so that one product appears on the PayPal's Shopping Cart, but I want to add ALL products to PayPal's Shopping Cart.

I can add HTML code like this:

[syntax="html"]<form target="paypal" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="submit" name="submit" value="Pay with PayPal" />
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="on0" value="username" />
<input type="hidden" name="os0" value="$u_username" />
<input type="hidden" name="add" value="1" />
<input type="hidden" name="cmd" value="_cart" />
<input type="hidden" name="business" value="kaisellgren@gmail.com" />
<input type="hidden" name="item_name" value="Template" />
<input type="hidden" name="item_number" value="1" />
<input type="hidden" name="amount" value="20.00" />
<input type="hidden" name="no_shipping" value="0" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="lc" value="FI" />
<input type="hidden" name="bn" value="PP-ShopCartBF" />
</form>
And it adds one product on PayPal's shopping cart, but I was thinking about adding all products into PayPal's shopping cart without asking customer to press Buy Now button for each product...


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
dhrosti
Forum Commoner
Posts: 90
Joined: Wed Jan 10, 2007 5:01 am
Location: Leeds, UK

Post by dhrosti »

as far as i'm aware, its a different system at PayPal's end. One option is just for a one-time 'buy now' (or the total cart added up), and the other option is a fully itemised order.
User avatar
kaisellgren
DevNet Resident
Posts: 1675
Joined: Sat Jan 07, 2006 5:52 am
Location: Lahti, Finland.

Post by kaisellgren »

What is fully itemised order?

I tried to fsockopen and send POST variables just like the HTML form does, but it seems that those items are put in the shopping cart of IP which has the PHP installed...
User avatar
dhrosti
Forum Commoner
Posts: 90
Joined: Wed Jan 10, 2007 5:01 am
Location: Leeds, UK

Post by dhrosti »

sorry, im not too good at explaining things...

PayPal has two ways to process your order:

1. It takes 1 value (ie. the total amount), and processes that single value. Or...

2. It takes all the items in your shopping cart and processes it as a proper order with an itemised invoice, etc.

But as these are two different systems, it depends which one you registered for.

I'm not 100% certain on this by the way, but this is what i understood from looking at PayPal.
Post Reply