Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 07-24-2025 14:09:37

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1727

New orders not being initiated after payment.

Hi NIck

I've had this niggle for years, and always assumed it was a connection error or something. I've been looking into it a bit more recently to try and find out what causes it.

Occassionally(2-3 a day out of 150 - 250 orders) I get a new order that doesn't get initiated. The status stays as P, and statusinit, statusenabled, statusinvprocessed and statusserviced remain as 0. Custpaytotal does get updated with the correct amount paid and orderbalance updates to 0.

So, half of the order processing is updated which makes me think procgwresp() runs until ordersave() at which point something breaks or errors out.

I only use protxform as the payment method for all orders, and 99% process correctly. I also don't think customers are aware of an error as they never contact us to advise of an error making payment, so they must be getting a payment complete message of some kind.

I set up a half hourly cron job years ago which checks for any orders where custpaytotal > 0 and status = P. This works perfectly to catch any paid orders which haven't been processed correctly, so it isn't much of an issue. Just an annoyance and I'm bored.

Any thoughts on what to look for? It is difficult as I cannot reproduce the error.

Thanks
Rob


Rob

Offline

 

#2 07-25-2025 08:42:18

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Well, as you said, if customers aren't complaining then they're likely seeing order confirmation pages.  It would be good to run file-based debugging for a day and see if you can catch anything.  My first look would be a mail server issue, although the save happens before mails go out.  It could be an issue with an OrderMan::init script (custom).  It could be a PHP/MySQL issue: MySQL/MariaDB are touchy with errors on PHP8+ and our version 9.4 is set up to handle this better than any previous versions.  Since we just released 9.4, and that had a bunch of PHP8 updates in it, even if you're not running PHP8 yet, I'd recommend upgrading and see if this issue goes away.  If not, I'd be happy to work with you further to identify and correct whatever is going on.


Nick Hendler

Offline

 

#3 07-27-2025 06:14:34

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1727

Re: New orders not being initiated after payment.

Hi Nick

I currently running php 8.1, but don't think php version is the issue as I have had this problem with various php versions from years ago.

Here is the debug for one instance of error I found. Looks like the email address is being lost which causes a fatal error in orderlookup.

ECOM_OLP::constructor: Accessed.

...

CORE_Error::shutdown: Beginning clean shutdown.


Rob

Offline

 

#4 07-28-2025 08:54:01

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Thank you for this.  I adjusted your post to remove a bunch of debug lines with store data in them.  I'm seeing an issue here:

Code:

CORE_Session::sessupdate: BULKNOUPDATES session update: Array ( [email]=> ) 

CORE_Error::error: Fatal error encountered: Cannot use object of type COREerror as array

I'm looking into it.


Nick Hendler

Offline

 

#5 07-29-2025 09:40:51

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Another thought on this - are you running version 9.4 yet?  There were many changes to 9.4 to make it compatible up to PHP8.4.  You might be running into a PHP8 issue if you have not upgraded yet.  I'm still digging, but I figured I'd throw this out there.  I'm investigating on 9.4, FYI.


Nick Hendler

Offline

 

#6 07-29-2025 10:46:08

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Thanks for the alert - confirming you're running 9.4 and it's an issue on that version.


Nick Hendler

Offline

 

#7 07-29-2025 10:53:08

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1727

Re: New orders not being initiated after payment.

yes, 9.4. The fault has been evident for years in all v9 versions so definitely not a recent change. It's not really a big issue as my cron job catches the errors anyway, so don't waste too much time on it.

Sorry Nick, I think I reported the post instead of replying to it!!

Last edited by zanart (07-29-2025 10:54:03)


Rob

Offline

 

#8 08-03-2025 04:58:18

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1727

Re: New orders not being initiated after payment.

Hi Nick.
Not sure if the Fatal Error is relevant to my problem as I think I may have found the cause.

If you recall, we previously had an issue with a sagepay payment error due to duplicate order numbers not being allowed. In olpform.php we added some logic so checkoutron was run if checkout page was hit again, so a new order number was issued. This resolved the sagepay duplicate transaction issue.

It seems, on rare occassions, a new order number is still raised when users are directed back to site after successful payment, even though they shouldn't get a new order number. This updates the core_session.ecom.cosess with the new order number, and $process_order in ECOM_OrderMan is 0 as $cosess['order_number'] doesn't match the $order['order']['id']. Orderprocess function ends as it thinks the order has already been processed.

I'm trying to create a work around as don't won't to remove the original logic.


Rob

Offline

 

#9 08-04-2025 10:51:51

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Thanks for the additional info.  I was thinking along the same lines that this may be an intermittent issue with SagePay centering around the order number regeneration.  Do you see anything in common with the orders having issues?  I'm thinking this is more of a browser issue and you won't have that info.  I'm looking deeper into the SagePay logic.


Nick Hendler

Offline

 

#10 08-04-2025 13:26:28

zanart
Member
From: bedford
Registered: 04-02-2008
Posts: 1727

Re: New orders not being initiated after payment.

a bit more info....
In olpform.php you have this code

Code:

    
$js_windowload  = 'jQuery(\'#PAYMENT\').submit(function(){';
$js_windowload .= 'if (window.history && window.history.pushState) {window.history.pushState(\'forward\', null, \'' . $this->link_namespace('ecom','checkoutron') . '\');}';
$js_windowload .= '});';

However, I changed this code a long time ago to

Code:

$js_docready = 'jQuery(\'#PAYMENT--SUBMIT\').click(function(){';
$js_docready .= 'if (window.history && window.history.pushState) {setTimeout(function() {ajaxExec({\'primary\': \'ContentWithTitle\', \'callback\': \'ajaxExecResult\',\'app\': \'ecom\',\'ns\': \'checkoutron\'});}, 1500);}';
$js_docready .= '});';

Today I changed back to your version of the code to see if I still have the error we are discussing - I don't appear to as no issues for last 36 hours with orders not being initiated.

However, your code doesn't do what I need it to do - refresh the order number if user clicks back button from sagepay and changes the total amount.
Sagepay won't allow a transaction with the same order number but a different total amount. It just directs user to a generic Form Failed page with no information or error code.

Using your code I know I have missed 3 sales today as sagepay lists the invalid transactions and the errors:
4002 : An active transaction with this VendorTxCode has been found but the Amount is different.
These 3 customers haven't been able to resolve the issue and didn't place any orders.

I think the invalid sagepay issue is always caused when user goes to sagepay and then remembers the loyalty points so returns to my site. They click the loyalty point box and total amount changes. Sagepay now has same order number but different total amount which results in the invalid error.

Using my code, I do not get the invalid error as order number is refreshed every time the user backs out of sagepay, but I do get the orders not being processed error due to order number being refreshed incorrectly after successful payment.

For now I think I stick with catching the orders that aren't being processed as that is better than losing the orders altogether.

Can you think of any improvement to the order number refresh code I could try.

Last edited by zanart (08-04-2025 13:34:19)


Rob

Offline

 

#11 08-05-2025 09:49:55

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19938
Website

Re: New orders not being initiated after payment.

Thanks for posting the code you're using with the detailed explanation.  Those are doing two different things.  I'm still looking at the various scenarios and triggers on my end.  There's got to be a better way to handle this then dealing with back button JS.


Nick Hendler

Offline

 

Board footer