Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Juan Carlos Ferreiro
8,478 Pointsphp paypal shoppingcart
Is it possible to get information out of the paypal about how many item are on the paypal shopping cart??? I want to use this information for my website to show the customer the amounts of items in their paypal shopping cart while they keep shopping.
4 Answers
Shawn Jones
15,579 PointsAs I keep reading, I see it's beyond the scope of anything here at Treehouse. the link on that page leads here.
https://developer.paypal.com/webapps/developer/docs/integration/direct/make-your-first-call/
Juan Carlos Ferreiro
8,478 Pointshow and where on the built website i access paypal $_SESSION array in my code? when i do this is gives me null:
<?php var_dump($_SESSION); ?>
Shawn Jones
15,579 PointsSorry, if you want gain information from paypal as far as how many items are in the cart, you have to generate a token for access. From there you retreive the items and can count them and store the number in a variable. then you could use that variable anywhere in your site.
Juan Carlos Ferreiro
8,478 PointsThank you. It seems that's what im looking for.
Shawn Jones
15,579 PointsShawn Jones
15,579 PointsHey Juan,
In the php library section, there's a course called, "Build a Simple PHP Application". This course is basically a way of teaching how to build the backend for most ecommerce sites. In this section, there's a sub section which talks about integrating with Paypal. I took it a while ago and refer to it regularly.
Basically, your grabbing button codes from Paypal, linking them with specific products on your ecommerce site, and saving their actions in the global _session associate array. You are able to display a cart to them on your site before whisking them away to Paypal to pay. This section covers all of that.
Hope this helps.
http://teamtreehouse.com/library/build-a-simple-php-application
If you want to show them the amount, I would image you would use the php count function and count the items within the global $_SESSION array and store that number in a variable. You can then use that variable anywhere in your php to display what they've selected so far.