Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How I got PayPal and Ecommerce module to work

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

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

Page: 1
Go to End
Author Topic: 5674 Views
  • 3pointross
    Avatar
    Community Member
    18 Posts

    How I got PayPal and Ecommerce module to work Link to this post

    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

  • banal
    Avatar
    Community Member
    901 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

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

  • sjbmaine
    Avatar
    Community Member
    17 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

    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?

  • 3pointross
    Avatar
    Community Member
    18 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

    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?

  • Corrie Sloot
    Avatar
    Community Member
    2 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

    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.

  • pianomansam
    Avatar
    Community Member
    9 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

    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.

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: How I got PayPal and Ecommerce module to work Link to this post

    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!!

    5674 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.