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.

E-Commerce Modules /

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

Return from paypal payment - blank page


Reply


4 Posts   1720 Views

Avatar
CHD

Community Member, 218 Posts

4 September 2010 at 2:57am

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!

Avatar
CHD

Community Member, 218 Posts

4 September 2010 at 3:00am

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.

Avatar
Bambii7

Community Member, 254 Posts

8 September 2010 at 3:54pm

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.

Avatar
vancouverWill

Community Member, 121 Posts

27 October 2010 at 11:27am

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