After a whole day of searching for an answer and struggling with
trying to make the component work, I finally got it working in Cake
1.2. I'm relatively new to Cake, but have been working with PHP for
over 5 year, so there are a few things that I'm not sure if I used the
best way to do it.

So this are the confusions I got:
1. The PEAR directory I comes like PEAR-1.8.1/PEAR. I wasn't sure of
which of the two directories I should uncompress and where. Also I had
confusions with what directories should be uncompressed from the
PayPal SDK.
For the PEAR directory, you should uncompress the files so you get the
file PEAR.php in vendors/PEAR/ (vendors/PEAR/PEAR.php).
For the SDK, you should uncompress the php-sdk/lib directory at
vendors/PEAR/.
The final directory structure should look like the following: (only
showing the main files, not all of them)
->{CAKE}/app/vendors
   ->./PEAR
      ->./HTTP
      ->./Log
      ->./Net
      ->./PayPal
      ->./PEAR
      ->PayPal.php
      ->Multi.php
      ->Log.php
      ->PEAR.php
      ->Multi.php

2. The second confusion I had was how to replace the vendors call to
App::import() for Cake 1.2... Unfortunately this wasn't working for me
at all. So I (and this is the part that I think is not how it's
supposed to be done, but I worked for me) went to the bootstrap file
({cake}/app/config/bootstrap.php) and added the following code to the
bottom of the file:
[CODE]set_include_path(dirname
(__FILE__).DS.'..'.DS.'vendors'.DS.'PEAR'.PATH_SEPARATOR.get_include_path
());[/CODE]
This sets the PEAR directory in the vendors file as part of the
include path, so all the require calls from {cake}/app/controllers/
components/paypal.php work fine.

3. I'm a bit ashamed of this one, but I forgot for a moment that they
were talking about a component for I was a bit confused of were to put
the paypal component content. It was a stupid confusion, but if
anybody has a doubt, you have to put the component in {cake}/app/
controllers/components/paypal.php.

Those were the main confusions that were bugging me during the whole
day.

To make the component work, follow this steps:
1. Download PEAR and place it how it's explained in my confusions #1
(above)
2. Download the PayPal PHP SDK (https://cms.paypal.com/us/cgi-bin/?
cmd=_render-content&content_ID=developer/library_download_sdks) and
uncompress it how I explained in my confusions #1 (above) ->
3. Create the file {cake}/app/controllers/components/paypal.php and
write the components content (http://bakery.cakephp.org/leafs/view/22)
in this file.
4. Don't forget to add 'Paypal' to your controller's components: var
$components = array('Paypal');
5. Change the credentials (username,password and signature/
certificate) to your paypal's account
Note: In the example code, a certificate is being used instead of a
signature. Paypal let you use one or the other, if you use signature,
change the method call from $this->Paypal->setCertificate() to $this-
>Paypal->setSignature().
6. You should be able to use now the example code at
http://bakery.cakephp.org/leafs/view/20

I hope this was helpful for somebody. If you have any questions you
can send me an email and I'll try to help you!

Regards dudes!

Tags: PayPal Direct Payment API Component, Cake 1.2, PPW, Error, How
To, PayPal

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to