Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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


alex@mypos.co.uk

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

Link to comment
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
Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
Share on other sites

  • 3 weeks later...

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!

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

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 shop Phoenix 1.0.8.4 on PHP 7.4 Working my way up the versions.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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

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

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...