Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.


Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

new paypal payment code for ecommerce


20 Posts   34914 Views


1 May 2008 at 9:34pm Community Member, 8 Posts

Hi ak,

I'm new to SS and PHP etc - can i pls get some more detailed instructions on how to setup the paypal extensions - i've tried to copy and paste the code samples but all i've managed to do is to break my ecommerce install :-(

any help would be greatly appreciated




6 June 2008 at 2:08am Community Member, 1 Post

I would love to see some step by step ( line by line ) instructions also...
Would be great for many who are new to SS.



7 June 2008 at 11:22am Community Member, 9 Posts

Hi Nicolaas, Thanks for all the great work and advice with SS. We are beginning to develop some really dynamic sites on this platform. This post is the most relevant to our needs now... in the states, most small to midsize businesses utilize paypal opposed to other costly merch ant services. So, we are about to follow your lead with the code posted... have there been any updates or developments to paypal integration since your last post in March which asked for a code review. Wondering if you or anyone in the community have had continued success or have needed/added any tweaks.

Thanks in advance. Also, if you are ever searching for design/dev work, please contact me, all of the team that works with me are freelance.



9 June 2008 at 10:17am Community Member, 7 Posts

Hi All

Hope this helps

Yes we have implemented the paypal plugin successfully into Silverstripe

First of all download the paypal.rar file from here

Copy PayPalPayment.php from the archive to [yoursite]/ecommerce/code

Open up this file and set self::$payPalRealAccount to the paypal email address of the merchant account

Copy to [yoursite]/ecommerce/templates/Includes

Go to your _config.php file for your site....usually located under the mysite folder and add the following code to it

// Define which payment methods your site uses.
'ChequePayment' => 'Cheque',
'PayPalPayment' => 'Credit Card'

If you aren't going to accept offline payments then remove the chequepayment line

Finally run db/build?flush=1 and that should be it


20 June 2008 at 9:20am Forum Moderator, 801 Posts

we've got a paypal class in ecommerce trunk that romain currently works on.
looks like its a mod of nicolaas' class, not sure what the story behind that is - but have a look at:

i've asked romain to have a look at this thread as well.


20 June 2008 at 9:58am Community Member, 9 Posts

We were able to successfully integrate the PayPal code for the eCommerce module. The help Nicolass provided on this thread as well as the links were right on track. I think the only think left is a quick fix for a "View My Cart" button on each preliminary product without having to click through to that product page. Easy enough. You can take a look at our client's site/store/checkout on our server at we are still in beta, but it is fully operation besides all of the content. Thanks again to all, great instruction Nicolass... saved us from going to a third party solution.


6 August 2008 at 12:54pm Community Member, 20 Posts

in your steps you mention to...

Copy PayPalPayment.php from the archive to [yoursite]/ecommerce/code

Open up this file and set self::$payPalRealAccount to the paypal email address of the merchant account

is this where I'm suppose to make the changes

[ code]
protected static $payPalRealAccount; static function setPayPalRealAccount($payPalRealAccount) { self::$payPalRealAccount = [ b]$payPalRealAccount;[ /b] }
[ /code]

is this how it should be...

[ code]
protected static $payPalRealAccount; static function setPayPalRealAccount($payPalRealAccount) { self::$payPalRealAccount = [ b]MY EMAIL ADDRESS GOES HERE;[ /b] }
[ /code]

is this the only place I need to change the code?


6 August 2008 at 3:06pm Forum Moderator, 213 Posts

The idea is that the class are not altered and that you create configuration in the /ecommerce/_config.php file using something like

{name of class here}::setAccount($yourPPEmailHere);

where setAccount is the static function in the class

e.g. class could contain something like:

class {
static function setAccount($name) {