PPExt - PayPal extension

install curl in your server… :rolleyes:

You need to install CURL on your server, see PHP manual - curl.

Thanks for this great extension. I’ve been following this discussion, and I’ve integrated PayPal into the project I am working on reasonably easily.

I am however encountering a problem now. (I don’t want to call it a small problem, even though it probably is.)

I got the IPN notifications working on Monday. I made a PayPal payment using the sandbox and my code was notified of the payment and I was able to update the sales record as being payment complete. Very nice. I then went on to other parts of the project.

Today I decided to do another sandbox payment, and this time I did not receive any notification. PayPal IPN history tells me that it has sent a notification, but my logs do not show anything coming in. (They did when it worked the other day.)

From what I’ve read the sandbox can be a bit flakey, but this worries me. I believe my code is working (since it did) but I’d like to be sure.

Is this something you are experience with?

BTW, I’ve heard that there is an IPN simulator. But I can’t find it. Any clues where to look?

Thanks.

I figured it out. Turns out the sandbox was sending, but I had added some code to force login on the module and forgot to exclude the IPN handler. Doh! :huh:

It’s working nicely now! Woo Hoo!

hello guys,

I’m trying to get this module to work but receiving the following error:




// ---- URL: payPal/PPTest/create


NVP request failed

Request:BUTTONTYPE=BUYNOW&METHOD=BMCreateButton&VERSION=63.0&USER=PAYPAL_USER_ID&PWD=PAYPALPASSWORD&SIGNATURE=PAYPALSIGNATURE

Response:TIMESTAMP=2011-11-09T22:06:30Z&CORRELATIONID=fa74e23d8b3121212205f&ACK=Failure&VERSION=63.0&BUILD=2230381&L_ERRORCODE0=10002&L_SHORTMESSAGE0=Security

error&L_LONGMESSAGE0=Security header is not valid&L_SEVERITYCODE0=Error

in /var/www/p/ppal/protected/modules/payPal/components/PPUtils.php (226)

in /var/www/p/ppal/protected/modules/payPal/components/PPButtonManager.php

(59)

in

/var/www/p/ppal/protected/modules/payPal/controllers/PPTestController.php

(22)



[color="#FF0000"]Security header is not valid&L_SEVERITYCODE0=Error[/color]

If I mess around with my username or pass I get a different error saying the I can’t call that API, which means (I assume) that the Curl call works.

I also updated the PPUtils’s httpGet with (but got the same result):




curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);



thanks for your help,

–iM

my bad, I was using the wrong [i]env[/i]. works like a charm :)

thx,

–iM

Is there any way to use a custom image with the Buy Now button without having it hosted on PP? I tried:

‘L_BUTTONVAR7’=>‘image=https://www.mysite.com/paypal-button.gif’,

but that does nothing. Thanks!

See Post #70

I have tried BUTTONTYPE=PAYMENT but it gives me this error:

Response:TIMESTAMP=2011-11-19T19:34:57Z&CORRELATIONID=a32e1c3cb5bba&ACK=Failure&VERSION=65.2&BUILD=2230381&L_ERRORCODE0=13117&L_SHORTMESSAGE0=Invalid Argument&L_LONGMESSAGE0=Subtotal amount is not valid.&L_SEVERITYCODE0=Error

So I added a Subtotal field:

‘L_BUTTONVAR8’=>‘subtotal=’ . sprintf(’%02.2f’, $orderTotal),

Now it DOES generate a "Pay Now" button but when you click on it it goes to securepayments.paypal.com instead of www.paypal.com and I get the error:

Your payment can’t be processed at this time. Please try again later.

I just want to be able to create a BUYNOW button with a custom image. I know that when you create buttons via the PayPal site you can select the Buy Now button or Pay Now button or a custom image, but then that is a button with a fixed total value. I need to assign the orderTotal value dynamically. Any suggestions? Thanks.

Well, I haven’t been able to figure out how to do it with php so I’m doing it with jquery:




<script>

$('input[type="image"]').attr('src', 'https://www.mysite.com/images/paypal-button.gif');

</script>



Is this bad/unsecure?

It’s not insecure (assuming that you do all the validation and payment processing server-side), but I would do it in PHP, you can use DOMDocument to parse HTML, or do it using a simple regex (DOMDocument would be the best solution).

Example regex:




// Supports the following format (will fail if src is placed before type): 

// <input ... type="image" src="..." ...

// $buttonHtml is button code from PayPal

$myurl = 'http://myimage.png';

echo preg_replace('/(<\s*input.*?type="image".*?src=").*?(")/', '$1'.$myurl.'$2', $buttonHtml);




Thank you Stianlik, the regex worked like a charm! Since I only have one button on the checkout page that is of type image, regex worked perfectly. Thank you for your prompt and helpful response as always.

I meet a error, can you tell me how to fix it, thank you ^^

and say me wrong if i setup a IPN with url: http://mysite.com/payPal/PPDefault/ipn

Hi!,

Really, nice module…

I’m writing a kind of “brief starting up” tutorial to those who want to use it…

I managed to create the button and modify its properties… But, the big question is… What is next when the user press the "buy now" button" and the controller (actionCreate function, for instance) knows the button ID provided for paypal?.. How I continue with IPN or PDT procedure? :S

Could you give me some directions? :S

Thanks in advance!!!!!

E.

hi stianlik, thanks a lot for this wonderful extension. While using the PPStoreExample/admin I successfully created a button. But when I try to remove it, it says it was successfully removed but it keeps being showed in the page. When i click on it i get an error from PayPal as if it was already removed from their servers. How can I do to remove it from my page too.

Dear All,

My code is looking working properly but button is not showing in my view file. Please look below my code…

My config.php

'modules'=&gt;array(


	// uncomment the following to enable the Gii tool


	


	'payPal'=&gt;array(


    			'env'=&gt;'',


    			'account'=&gt;array(


        				'username'=&gt;'my username here',


        				'password'=&gt;'my password',


       				'signature'=&gt;'my signature',


        				'email'=&gt;'my email id',


        				'identityToken'=&gt;'my id token',


   			 ),


    			'components'=&gt;array(


        				'buttonManager'=&gt;array(


           				 	//'class'=&gt;'payPal.components.PPDbButtonManager'


            				'class'=&gt;'payPal.components.PPPhpButtonManager',


         				),


    			),


		),

In view (order/checkout.php)

&#036;buttonManager = Yii::app()-&gt;getModule('payPal')-&gt;buttonManager; 


&#036;nvp = array(                     'BUTTONTYPE'=&gt;'BUYNOW',                     'L_BUTTONVAR0'=&gt;'currency_code=USD',                     'L_BUTTONVAR1'=&gt;'item_name=My item name',                     'L_BUTTONVAR2'=&gt;'amount=200.00',                 ); 


 &#036;btnId = helpers::genRandomString();   /// generate randon number


 &#036;buttonManager-&gt;createButton(&#036;btnId, &#036;nvp);

In my log :

below message in showing yellow color





Successfully created buttonRequest:BUTTONTYPE=BUYNOW&amp;L_BUTTONVAR0=currency_code=USD&amp;L_BUTTONVAR1=item_name=Myitem name&amp;L_BUTTONVAR2=amount=200.00&amp;METHOD=BMCreateButtonin/home/website_dir/public_html/dev/protected/modules/payPal/components/PPButtonManager.php(240)in/home/website_dir/public_html/dev/protected/modules/payPal/components/PPButtonManager.php(72)in /home/website_dir/public_html/dev/protected/views/order/checkout.php (56)

But there is no button is showing in my view file… Please help

Thanks in advance…

You need to do


echo($buttonManager->webSiteCode);

Hi,

I’m trying to get the extension working, but I’m already stuck at creating a button. Whenever I try to create a button I get the following:


require(/usr/home/c2p/sites/protected/modules/payPal/data/buttons.php) [<a href='function.require'>function.require</a>]: failed to open stream: No such file or directory 

The error comes from: /usr/home/c2p/sites/protected/modules/payPal/models/PPPhpButton.php(78)

On my site users can add items to their shopping cart and when they’re done adding stuff they can choose to pay with paypal (or another) so the amount etc. is going to be different each time, a lot like post 67.

Where am I going wrong?

Hi,

The extension works just great .

I have a question regarding the generated buttons.

I want to use it in a checkout process that means each amount is different , so i have to create a new button for each order checkout .

It will ends up with thousands of differents buttons that are only use once , what do you think ? is this could be an issue , is there any way to clean up buttons ?

Thanks again

In webapp/config/main.php file, try commenting out the UrlManager component. But after this, if you hardcoded any links to one of your pages like (index.php/user/view) you need to modify them too.