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.

Archive

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

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

How I got PayPal and Ecommerce module to work


Reply

7 Posts   5690 Views

Avatar
3pointross

9 October 2008 at 2:23am Community Member, 19 Posts

I had a hell of a time getting paypal and ecommerce to work, and it seems all the documentation is spread out so I figured I would post what worked for me. Seem others had the same issues.

I was not able to get paypal to work with the supplied PayPalPayment.php which is located in the ecommerce/code directory (so it would be http://www.mysite.com/ecommerce/code/PayPalPayment.php).

However there is an updated version of the file and can be obtained here:
http://open.silverstripe.com/ticket/1760

Upload that over your existing http://www.mysite.com/ecommerce/code/PayPalPayment.php

The next step is to configure your http://www.mysite.com/ecommerce/_config.php to add the paypal information you need.

This is what I added

Payment::set_supported_methods(array(
'PayPalPayment' => 'Credit Card (Paypal)'
));

// Set the email of the admin who looks after receiving the order emails.
Order::set_email('ross@3point7designs.com');

//Real account for paypal
PayPalPayment::setPayPalRealAccount('info@3point7designs.com');

//Test account for paypal
PayPalPayment::setPayPalTestAccount('info@3point7designs.com');

//Who to send test payment from
PayPalPayment::setPayPalUseTestAccount('info@3point7designs.com');

Then you must edit the /ecommerce/code/CheckoutPage.php

and change this:

class CheckoutPage extends Page{
   
   static $db = array(
      "PurchaseComplete" => "HTMLText",
      "ChequeMessage" => "HTMLText"
   );

...

to this

class CheckoutPage extends Page{

      
   static $db = array(
      "PurchaseComplete" => "HTMLText",
      "PayPalInstructions" => "HTMLText", //add paypal instructions
      "ChequeMessage" => "HTMLText"
   );
      

Hope this helps those who had/have similar problems. After doing these changes and going to http://www.mysite.com/checkout/?flush=1 paypal showed up

Avatar
banal

10 October 2008 at 5:03am Community Member, 901 Posts

Sounds like something that should be put into the documentation wiki. It will surely get lost here.

Avatar
sjbmaine

16 October 2008 at 3:05am (Last edited: 16 October 2008 3:27am), Community Member, 17 Posts

Thank you so much for posting this. I've been struggling with the PayPal issue for a client. I've implemented everything you've outlined. PayPal shows up in my cart, but when I get to http://www.mysite.net/demo/checkout/ I have the following choices: Credit Card (Paypal) AND preferred payment method (select one) VISA, MASTERCARD, AMEX, PayPal.

If I select PayPal in either case as the payment option, when I click place order and make payment I simply get a blank screen the following url: http://www.mysite.net/demo/checkout/?executeForm=OrderForm

Do you have any thoughts/advice on this?

Avatar
3pointross

17 October 2008 at 4:15am Community Member, 19 Posts

Hmm, I don't have that problem but I usually select paypal AND a credit card I wish to pay with... maybe try that and see how it works?

Avatar
Corrie Sloot

31 October 2008 at 7:10am (Last edited: 31 October 2008 7:54am), Community Member, 2 Posts

You need to create a template the template file:

/ecommerce/templates/includes/paypalPaymentPage.ss

It should be a regular template page, with $PayPalInstructions and $Content in the content area.

I made mine just say "Redirecting to PayPal", and then used JavaScript to submit the PayPal form.

Avatar
pianomansam

4 November 2008 at 10:21am Community Member, 9 Posts

Thanks so much for the very helpful guide. I have PayPal up and running with Ecommerce. I did run into a problem coming back from a successful payment, though. in PayPalPament.php on lines #230 and #233, the code calls a view that does not exist: ConfirmPayPal. By changing line 230 to be OrderSuccessful instead and 233 to be OrderIncomplete, I get proper returns from payments.

Avatar
Howard

8 December 2008 at 4:38pm Community Member, 215 Posts

Hey there, i am following this thread trying to set up paypal as well but now, after iv made those changes no pages are able to load and it is saying

"Fatal error: Access to undeclared static property: PayPalPayment_Handler::$URLSegment in /home/howardgr/public_html/lynnescolours.co.nz/ecommerce/_config.php on line 31"

If I remove "PayPalPayment_Handler::$URLSegment . '/$Action/$ID' => 'PayPalPayment_Handler'" from my ecommerce/_mysite.php file then the site loads but I when I process payment it errors and doesn't get as far as paypal.

Any help would be appreciated!!