Jump to content
Sign in to follow this  
alex@mypos.co.uk

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

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

 

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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!

Senior PHP Dev with 18+ years of commercial experience for hire, all requirements considered, see profile for more information.

Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here.

Share this post


Link to post
Share on other sites

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:

Share this post


Link to post
Share on other sites

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


Live Phoenix 1.0.5.0 on PHP 7.3

Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix 1.0.7.9) here.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

 

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!

Senior PHP Dev with 18+ years of commercial experience for hire, all requirements considered, see profile for more information.

Is your version of osC up to date? You'll find the latest osC version (the community-supported responsive version) here.

Share this post


Link to post
Share on other sites

I've entered the link into the junior_callback.php file and this now presents the user with a clickable link

 

When this is clicked however it adds a 2nd order entry into the databse marked with 'Preparing [WorldPay]' (and triggers an order success email)

 

The automatic callback is marking the primary order as paid but not sending out the order success email.

 

Any ideas? Is it a setting in Worlpay admin screens causing this?

 

Thanks


===============

Simple yet Creative

Get Online Web Design : getonlinedesign.com

===============

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×