Jump to:

2088 Posts in 1008 Topics by 455 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Return from paypal payment - blank page

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1692 Views
  • CHD
    Avatar
    Community Member
    218 Posts

    Return from paypal payment - blank page Link to this post

    hey guys, wondering if any of you can help with this...

    i had my site up and running pretty well with eCommerce and paypal, but over the last 2 days ive made some amends/fixes here and there...and now on testing today ive realised my return from paypal has died!

    i just get the blank white screen of death when i return from paypal after payment has been made.
    this used to work, but i have NO idea what has happened to break it?!

    ive been going through files trying to re-upload old versions but getting nowhere, thought it might be best if somebody with more no how could advise me exactly which files will have an impact on this page?

    the only thing i can do to get past the white screen of death is to modify this part of the paypalPayments.php file:

    function complete() {
    if(isset($_REQUEST['custom']) && $custom = $_REQUEST['custom']) {
    $params = explode('-', $custom);
    if(count($params) == 2) {
    if($payment = DataObject::get_by_id('PayPalPayment', $params[0])) {
    if($payment->AuthorisationCode == $params[1]) {
    if(isset($_REQUEST['payment_status']) && $_REQUEST['payment_status'] == 'Completed') {
    $payment->Status = 'Success';
    $payment->TxnRef = $_REQUEST['txn_id'];
    }
    else {
    $payment->Status = 'Failure';
    }

    $payment->write();
    $payment->redirectToOrder();
    }


    but anything i do to that code just results in status being "payment failed" - even though it was a success.

    please help!
    im so gutted it was working and now its not! i should have just left it alone...

    I've attached all files that i thought might be related!

  • CHD
    Avatar
    Community Member
    218 Posts

    Re: Return from paypal payment - blank page Link to this post

    i should also add that the "cancel" side of it works fine!
    if you cancel the order once you reach paypal, it directs you back to the order ID page:

    http://www.zaharahair.co.uk/account/order/1044

    and says failure as it should.

  • Bambii7
    Avatar
    Community Member
    254 Posts

    Re: Return from paypal payment - blank page Link to this post

    Hmm strange,
    I would suggest the renaming of PayPalPayment5 to PayPalPayment so its the same name as the class. But if the cancel function then PayPalPayment5.php is probably still working fine.

    I found when I was playing around with it, if you disable javascript before you submit the check out page, you don't get redirected to Paypal and you can view page source of all the form variables.

    There will be a ton of hidden form fields, and you can check if "return" has been set. It should be yoursite.com/paypal/complete. If it is set it'll be an issue in the complete function in PayPalPayment.

  • vancouverWill
    Avatar
    Community Member
    121 Posts

    Re: Return from paypal payment - blank page Link to this post

    Did you manage to get this fixed?

    I commented out line 220 "jQuery('#PaymentForm').submit();", so as to stop the form being submitted and I can see that the authorization code isn't added to the return value

    <input type="hidden" name="cancel_return" value="http://ss-ecommerce.synergycc.biz/paypal/complete?custom=19-1851338858380c8426afa86af72713e7"/>
    <input type="hidden" name="return" value="http://ss-ecommerce.synergycc.biz/paypal/complete"/>

    on paypalpayment.php there are the lines

       $inputs['cancel_return'] = Director::absoluteBaseURL() . PayPalPayment_Handler::cancel_link($inputs['custom']);
          $inputs['return'] = Director::absoluteBaseURL() . PayPalPayment_Handler::complete_link();

    which call the functions

       static function complete_link() {
          return self::$URLSegment . '/complete';
       }
       
       static function cancel_link($custom) {
          return self::complete_link() . '?custom=' . $custom;
       }

    I am currently testing adding the authorization code to the end of the complete link to see if that works. i'll let you know, but if you have had any progress yourself would be much appreciated.

    cheers

    will
       

    1692 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.