This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

prestaPaypalPlugin need help

Ask help about existing plugins, or find advice about the way to build up your own.

prestaPaypalPlugin need help

by galthron » Thu May 13, 2010 7:15 pm

Can any one give me some "real" example of using this plugin becouse im trying to run this plugin in my project and it doesn`t work. I think i try every possible way of use. There is no redirect to paypal sanbox site , and no error. i`m out of time so i need to do this quickly and your help will be apprieciate
galthron
Junior Member
 
Posts: 9
Joined: Wed Nov 26, 2008 12:53 pm

Re: prestaPaypalPlugin need help

by halfer » Fri May 14, 2010 1:15 pm

What "doesn't work" about it? Have you enabled the plugin? Are you getting errors? What action code have you got at present? Be detailed in your report if you can.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: prestaPaypalPlugin need help

by galthron » Mon May 17, 2010 8:25 pm

When i`m trying to go direct payment method or express checkout nothing is happen. For example in express checkout case the line "$goto = $cc->GetExpressUrl();" is null and there is no error what is wrong. Of course i`ve got paypal account an i generated API signature. Probably i`m doing something wrong, but i`ve no idea what. I just tryed the examples from plugin readme. It`s no working for me
galthron
Junior Member
 
Posts: 9
Joined: Wed Nov 26, 2008 12:53 pm

Re: prestaPaypalPlugin need help

by galthron » Mon May 17, 2010 8:44 pm

i give up, it`s seems to working on not localhost server, but probably i`m steel doing something wrong, and maybe i missed something.

I`m trying to use express checkout.
after this:

Code: Select all
$cc = new prestaPaypal( sfConfig::get('sf_plugins_dir').DIRECTORY_SEPARATOR.'prestaPaypalPlugin'.DIRECTORY_SEPARATOR.'sdk'.DIRECTORY_SEPARATOR.'lib' );
      $cc->setUserName( 'mysandboxapiusername' );
      $cc->setPassword( 'mysandboxapipassword' );
      $cc->setSignature('mysandboxapisignature');
      $cc->setTestMode(true);
      sfLoader::loadHelpers(array('Url'));
      $cc->setCancelURL(url_for('order/cancelpaypal', true));
      $cc->setReturnURL(url_for('order/chargepaypal', true));
      $cc->setTransactionTotal('39.95');
      $cc->setTransactionDescription('Registration');
      $goto = $cc->GetExpressUrl();
      if ( $goto ){
              $this->redirect($goto);
      }else{
          $this->error = $cc->getErrorString() ;
      }



there is redirection to sandbox paypal site , where i can log in in my personal account, and after loggin to my account i`ve got standard information

"If the information below is correct, click Continue. You will confirm your payment on the next page.... etc"

and after clicking on "Countinue" there is a redirection to my site, without any information about payment, price etc.


i hope its clear.

p.s. The Website payment standard is working.

need help
galthron
Junior Member
 
Posts: 9
Joined: Wed Nov 26, 2008 12:53 pm

Re: prestaPaypalPlugin need help

by galthron » Fri May 21, 2010 8:34 pm

any one can help me ?
galthron
Junior Member
 
Posts: 9
Joined: Wed Nov 26, 2008 12:53 pm

Re: prestaPaypalPlugin need help

by halfer » Mon May 24, 2010 10:36 am

Have you tried contacting the author? - they might be able to help you. Or you might be able to trace the code in this plugin and match it up with the Paypal documentation, to see how it is meant to work. Perhaps you have missed an item of configuration?
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: prestaPaypalPlugin need help

by martinsettle » Mon Nov 01, 2010 4:46 am

Did you ever find a solution to this? I have been struggling with this plugin a bit...

In the prestaPaypal class file (in the lib/class directory) I have had to hardcode the country code and the currency (for me, CA and CAD). This then allows the SOAP system to query and get an express-checkout code from Paypal, but it does not seem to have transmitted any of the actual transaction details (i.e. cost and description). SInce there is no value for the transaction, when you click on continue it just redirects you to the transaction complete page.

This happens both in sandbox and live.

The odd thing is, the BasicAmountType, ExpressCheckoutType, and ExpressCheckoutRequestType all include the amount and description prior to getting the actual request URL. I think there must still be something wrong about the way the transaction details are being created and communicated to Paypal, but I can't figure out what
martinsettle
Junior Member
 
Posts: 2
Joined: Mon Nov 01, 2010 4:35 am

Re: prestaPaypalPlugin need help

by halfer » Mon Nov 01, 2010 1:00 pm

Have you tried contacting the author, via their plugin page?
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: prestaPaypalPlugin need help

by martinsettle » Mon Nov 08, 2010 4:47 pm

Okay, so I figured it out... Always helps to read the Paypal help file.

I had only set up WebPayments before, but I did not want to use the web payments implementation in the plugin, because it doesn't support encryption of the form data. So, I used the express checkout. This has a different flow, and therefore different requirements.

To get express checkout in prestaPaypalPlugin to send information to Paypal and actually approve the payment on the Paypal site rather than directing back to your site for approval, you need to change the redirect line in the example action to:

Code: Select all
         $this->redirect($goto.'&useraction=commit');


Then, on whatever page you have set as the returnURL in the previous request, you need to call the chargeExpressPaypal function, which of course requires the paypal object to be built again. My confirmation action looks like this:

Code: Select all
 public function executePaypalConfirm(sfWebRequest $request)
  {
    $this->forward404Unless($token = $request->getParameter('token'));
    $basket = BasketPeer::getUserBasket();
    $cc = new prestaPaypal();
    $cc->setUserName(sfConfig::get('mod_order_paypal_user'));
    $cc->setPassword(sfConfig::get('mod_order_paypal_password'));
    $cc->setSignature(sfConfig::get('mod_order_paypal_signature'));
    $cc->setTestMode(sfConfig::get('mod_order_paypal_test'));
    $cc->setTransactionTotal(round($basket->getTotalValue()/100,2));
    if(!$cc->chargeExpressCheckout($token)) $this->errormessage = $cc->getErrorString();
    $basket->setCheckedOut(1);
    $basket->save();
    }


Without the 'useraction=confirm' addition, you will need to have your returnURL page display the basket again, have the user authorize the payment, and then run the chargeExpressCheckout function in the subsequent action.

There were a couple of other changes I needed to make. First, the paypal certificates included in the plugin are out of date, so you need to replace the sdk directory with the latest version of the Paypal PHP API libraries. Then I also had to edit the prestaPaypal.class file to set the path for the Paypal SDK libraries, as they weren't linking automatically. I'm sure there is a more appropriate way of doing this, as my solution has to be edited every time I deploy the application, but what I did was to set up the library path in module.yml, and then push it onto the include path. From line 103 of prestaPaypal.class.php:

Code: Select all
   public function __construct($path=null)
   {
        $path = sfConfig::get('mod_order_paypal_path');
        if( !is_null($path) )
      {
         // Get rid of the many warnings from the Paypal API
         error_reporting(E_ERROR | E_WARNING | E_PARSE);
         ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . $path);
           
         require_once 'PayPal.php';
         require_once 'PayPal/Profile/Handler/Array.php';
         require_once 'PayPal/Profile/API.php';
      }
   }


I hope this helps someone!
martinsettle
Junior Member
 
Posts: 2
Joined: Mon Nov 01, 2010 4:35 am

Re: prestaPaypalPlugin need help

by halfer » Mon Nov 08, 2010 8:32 pm

Thanks for the solution.

It's a long shot, but in terms of the Paypal code being out of date, maybe you could drop Paypal Support an email and see if they have a subversion repo with these files (or perhaps they would create one)? If so, this would mean that the folder in this plugin could be replaced with an svn:externals reference, and that problem would not crop up again.
halfer
Faithful Member
 
Posts: 10148
Joined: Mon Jan 30, 2006 1:16 pm
Location: West Midlands, UK

Re: prestaPaypalPlugin need help

by pbkyriak » Wed Dec 14, 2011 10:03 pm

Thanks your solution helped me too!
pbkyriak
Junior Member
 
Posts: 4
Joined: Mon May 19, 2008 2:51 pm
Location: Greece

Re: prestaPaypalPlugin need help

by WenchDeal » Thu Oct 10, 2013 7:56 am

I had just set up Webpayments in the recent past, however I would like to utilize the web installments usage within the plugin, since it doesn't uphold encryption of the shape information. Thus, I utilized the express checkout.
WenchDeal
WenchDeal
Junior Member
 
Posts: 2
Joined: Wed Oct 09, 2013 8:51 am
Location: USA