Jump to content


Corporate Sponsors


Latest News: (loading..)

How to fix Worldpay Junior junior_callback.php going straight to results screen in rbsworldpay


21 replies to this topic

#1 alex@mypos.co.uk

  • Community Member
  • 5 posts
  • Real Name:Alex

Posted 09 September 2009, 09:29

I have been struggling with getting the junior_callback.php to actually work with worldpay and now know exactly what the problem was and thought I'd post it for everyone else.


Worldpay told me that if the call back page was returning an empty page they would just display their results page. So I guessed if it was returning an empty page it must have an error.

The error was that I was running php 5 and the $http_post_vars was deprecated and so needed to be replaced by $_POST.

That was pretty much it. I also realised at this point that worldpay seems to have disabled javascript so the button didn't work to return to the site as it uses onclick. So this would need to be changed for anyone using the default junior_postback.php.



Worldpay suggested using a meta refresh which I didn't look to see if you could redirect to another page with but may well be able to!

Hope this helps!!

#2 PhillT

  • Community Member
  • 4 posts
  • Real Name:Philip Taylor

Posted 15 September 2009, 13:45

I was also having problems with this, and yes the javascript is stripped from the button stopping the user being able to click it. As a quick fix to this problem I replaced the code that generated the broken button:

<p align="center"><input type="button" value="<?php echo sprintf(MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_CONTINUE_BUTTON, addslashes(STORE_NAME)); ?>" onclick="document.location.href='<?php echo tep_href_link(FILENAME_CHECKOUT_PROCESS, tep_session_name() . '=' . $HTTP_POST_VARS['M_sid'] . '&hash=' . $HTTP_POST_VARS['hash'], 'SSL', false); ?>';"></p>

With just a simple link shown below, so that the user can click it to go back to your shop. I didn't have it as a form button as the user will be prompted about submitting unencrypted information from the secure RBSWorldPay page, and it may throw some customers off, so by just having a link solves this problem:

<p align="center">
<a href ="http://WEBSITEURL/checkout_process.php?osCsid=<?php echo $_POST['M_sid']; ?>&hash=<?php echo $_POST['hash']; ?>">Click here to return to the store to complete your order</a>
</p>

Only a quick fix and the first thing I have edited myself on osCommerce, hope this makes sense and helps some people out. Obviously, this still requires the user to press the button in order for the database to be updated. If anyone knows how to do it automatically without the user having to press the button that'd be most helpful.

-Phill.

Edited by PhillT, 15 September 2009, 13:52.


#3 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 16 September 2009, 21:04

That's a neat little solution. Thanks.

#4 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 17 September 2009, 11:04

out of curiosity why does your button solution work back to checkout_process.php even though I have the callback in the WP enviroment set to junior_callback.php? :blink:

Can a basic html graphic be used instead of plain text?

#5 PhillT

  • Community Member
  • 4 posts
  • Real Name:Philip Taylor

Posted 17 September 2009, 14:31

View Postrgvsean, on Sep 17 2009, 11:04 AM, said:

out of curiosity why does your button solution work back to checkout_process.php even though I have the callback in the WP enviroment set to junior_callback.php? :blink:

Can a basic html graphic be used instead of plain text?

My link goes back to that page as that is where the original button sent you to. The junior_callback.php file is the one I edited to remove the broken button and replace with the text link. If you wish to use an image as the link then you can just put an image between the <a></a> tags rather than the text.

-Phill.

#6 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 17 September 2009, 14:54

Ah great,

so callback pulls the button code out of junior_callback and then the button sends you back to the cart, completing the whole process.

That's brilliant. Thank you.

A nice image should ensure customers are encouraged to click, the link on it's own looks a little lost.

#7 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 22 September 2009, 19:44

I used your button code and added some to get this:

Quote

<p class="pageHeading"><?php echo STORE_NAME; ?></p>

<p class="main" align="center"><?php echo MODULE_PAYMENT_WORLDPAY_JUNIOR_TEXT_SUCCESSFUL_TRANSACTION; ?></p>
<META http-equiv="refresh" content="4;URL=http://www.xxxxxxxxxxx.co.uk/store/checkout_process.php?osCsid=<?php echo $_POST['M_sid']; ?>&hash=<?php echo $_POST['hash']; ?>">

<p align="center">
<a href ="http://www.xxxxxxxxxxxx.co.uk/store/checkout_process.php?osCsid=<?php echo $_POST['M_sid']; ?>&hash=<?php echo $_POST['hash']; ?>">If you are not automatically returned after 5 seconds - Click here to return to the store to complete your order</a>
</p>

<p>&nbsp;</p>

<WPDISPLAY ITEM=banner>

What this does is give a link to press, and warn about a possible redirect.

The auto redirect works in 4 seconds (content="4;) and causes all the updates and e-mails.

You must have customer response enabled and have http://.........................................junior_callback as the response URL.

I hope this helps someone.

#8 PhillT

  • Community Member
  • 4 posts
  • Real Name:Philip Taylor

Posted 24 September 2009, 09:37

View Postrgvsean, on Sep 22 2009, 08:44 PM, said:

What this does is give a link to press, and warn about a possible redirect.

The auto redirect works in 4 seconds (content="4;) and causes all the updates and e-mails.

I hope this helps someone.

Thanks, I wasn't sure where to put that on the page, this ensures they get redirected back to the store and the order is complete.

Thanks,
-Phill.

#9 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 24 September 2009, 10:52

Nor me lol

I just figured if RBS are collecting the code for the button from there I'll drop it right next to it.

Lucky guess really :blush:

You could get rid of the button but it's a good back up I think :)

I also checked with RBS that it will continue to work after their changes planned for end of this month and they said it would.

#10 mapletree

  • Community Member
  • 8 posts
  • Real Name:paula

Posted 13 November 2009, 15:26

View Postrgvsean, on 22 September 2009, 19:44, said:

I used your button code and added some to get this:



What this does is give a link to press, and warn about a possible redirect.

The auto redirect works in 4 seconds (content="4;) and causes all the updates and e-mails.

You must have customer response enabled and have http://.........................................junior_callback as the response URL.

I hope this helps someone.

Great, I used your codes and it works well.

But I curiuos what this" $_POST['M_sid'] " and" $_POST['hash'] " for. As I am trying for a few days to bring the worldpay transaction id to show on admin side orders.php page, does nay one know how to work it out?

Appreciate your help.

#11 mielag

  • Community Member
  • 21 posts
  • Real Name:Michael
  • Gender:Male
  • Location:Dublin, Ireland

Posted 03 December 2009, 22:36

Great stuff, thanks for posting that here! had the same problem with with callback button and your solution is perfect!

I do however have a small problem - when I am sent back to store my confirmation page is not showing the order number - it only shows "Transaction: /09" when it should be "Transaction: 1000/09"... any idea where maybe be the problem???

thanks again for helping me out!

#12 peterbuzzin

  • Community Member
  • 37 posts
  • Real Name:Pete Batin
  • Gender:Male
  • Location:Kent, England

Posted 06 December 2009, 13:45

I had the same problem but unfortunately didn't find this post until after I spent ages figuring it out myself :(

However the good news is I've made an updated version of the contribution which also includes a failed payment response and redirects customers back to the payment selection page (deletes previous order and restocks to prevent duplicate orders)

Can be found here http://addons.oscommerce.com/info/7151

Pete
If it still don't work, hit it again!

#13 rgvsean

  • Community Member
  • 88 posts
  • Real Name:Sean

Posted 13 December 2009, 16:45

Sorry I've not been around to answer on these questions but I doubt I could have helped.
I am not a programmer I just had a stab at it as there wasn't much help available.

That looks like great work Peter :thumbsup:

#14 april_floyd

  • Community Member
  • 59 posts
  • Real Name:Tom Watson

Posted 22 December 2009, 20:58

tried using above but you can't use php in world pay edit pages - anybody know what the url should be to make this work

#15 mhvideos

  • Community Member
  • 85 posts
  • Real Name:Martin
  • Gender:Male
  • Location:Suffolk England

Posted 23 December 2009, 09:50

View Postapril_floyd, on 22 December 2009, 20:58, said:

tried using above but you can't use php in world pay edit pages - anybody know what the url should be to make this work


Use the code in post #7 above.

It goes in \ext\modules\payment\worldpay\junior_callback.php. It replaces a similar block of code

Do not get confused with the Worldpay payment page editor on their website

Martin

#16 april_floyd

  • Community Member
  • 59 posts
  • Real Name:Tom Watson

Posted 23 December 2009, 12:05

Thanks for the reply,

I have added the code to the file, but not sure what the exact url is below

'You must have customer response enabled and have http://.........................................junior_callback as the response URL.'

#17 april_floyd

  • Community Member
  • 59 posts
  • Real Name:Tom Watson

Posted 23 December 2009, 12:15

I would appreciate any help from anyone who has managed to get world pay and oscommerce to work.

Payment is OK, but can't get the emails to send from oscommmerce

#18 april_floyd

  • Community Member
  • 59 posts
  • Real Name:Tom Watson

Posted 23 December 2009, 12:21

Is this the correct url format?

http://www.xxx.co.uk/ext/modules/payment/worldpay/junior_callback.php

#19 peterbuzzin

  • Community Member
  • 37 posts
  • Real Name:Pete Batin
  • Gender:Male
  • Location:Kent, England

Posted 23 December 2009, 12:24

View Postapril_floyd, on 23 December 2009, 12:21, said:


Which contribution are you using?

There shouldn't be any need for you to enter the full url for the callback page.
If it still don't work, hit it again!

#20 april_floyd

  • Community Member
  • 59 posts
  • Real Name:Tom Watson

Posted 28 December 2009, 14:35

I am using - RBS Worldpay Form (which I think you created)

Do you know what the url is for the callback?