Jump to content
Sign in to follow this  

Nochex gives Syntax Error

Recommended Posts



I just switched on the Nochex payment module in but when I did a test purchase of ?1340.83, the nochex site gave the error:


Syntax error: 1,340.83 is not a valid number. Use the format xx.xx


It only seems to happen with values over ?999.99 so it must be the thousands separator.


I don't use a thousands separator on my site though.


Does anyone know what the problem could be?





Share this post

Link to post
Share on other sites

Hi. This is my first post, so I hope I get this right!


(All the following is assuming the nochex APC contrib, latest version)


I had the same problem trying to get a "Declined" message to test that functionality... It seems to be the number format in the Nochex form submission, not the currency format in the Admin form.


In checkout_nochex.php, around line 242, you'll find:


 tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->currencies['GBP']['value'], $currencies->currencies['GBP']['decimal_places']))


Replace that with


tep_draw_hidden_field('amount', number_format($order->info['total'] * $currencies->currencies['GBP']['value'], $currencies->currencies['GBP']['decimal_places'], '.', ''))


This changes the result of the PHP "number_format" function to use "." as the decimal and nothing as the thousands separator.


For others with the same issue on other payment systems, check the PHP doc at this page


As always, backup and test and don't blame me!


Best of luck,



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