Author Topic: Translator with Securepay Decimal Point PROBLEM  (Read 6130 times)


  • Beginner
  • *
  • Posts: 1
I followed various posts on this forum for setting up Securepay to be used with Virtuemart and thought things were fine. 

This post was very helpful:

However, there was a decimal point issue, where if an order was $25.30 the customer was charged $2.53. I made changes according to the post:

The next problem you will have is sending the amount of the transaction.
Virtuemart sends the $order_total of an item with NO CENTS, I.E. $185.00 as 185, and because the sent order_total doesnt contain a decimal securepay assumes the number
185 is 1.85 . (If your product "DOES HAVE CENTS" on your total this won't be a problem because virtuemart transmits the decimal IE: 185.01)...
If not this is a problem for two reasons.

Firstly your securepay secureguard "velocity settings" will decline this purchase because it is set to do so with transactions less than $3.00, and since we are only transmitting 185 and securepay's software interprets that as 1.85 .... you do the math.

Fix this by changing to from the recommended settings of deny and notify to notify only.

Secondly, we are only getting a hundreth of our price transmitted Shocked. While we have the ps_authorize.php file open AND your product DOES NOT HAVE CENTS IE: $185.00 <-- no cents, then you will need to find the line that looks like

'x_amount' => $order_total,

and change it to

'x_amount' => $order_total . ".00",

this concatenates the string ".00" to the end of the $order_total variable to make securepay get the value correct.

Things seemed to be working, but no.... NOW it is much worse.  Now if an order is $49.50 the system is charging $495.00!!

This only happens if there are zero's in the order total, one or two.

PLEASE HELP, has anyone fixed this issue?  If there is a fix, I would be willing to pay for it.

Also, can anyone reccommend a payment processor that is easy to set up and working fine with Virtuemart?

Thanking you in advance.


  • Beginner
  • *
  • Posts: 3
Re: Translator with Securepay Decimal Point PROBLEM
« Reply #1 on: November 02, 2009, 20:44:08 pm »
The following code worked for me. Basically find out if it has a decimal or not, then make sure it is in the correct format.
Code: [Select]
if(strpos($order_total,".") !== false){
//Is decimal
    $order_total_dec = number_format($order_total, 2, '.', '');
//Is NOT Decimal
$order_total_dec = $order_total . ".00";


  • Beginner
  • *
  • Posts: 1
Re: Translator with Securepay Decimal Point PROBLEM
« Reply #2 on: March 10, 2010, 22:36:48 pm »
Hi Drew,

This looks like the code I need.

Could you tell me what file it goes in and where it should go in the file?



  • Beginner
  • *
  • Posts: 6
Re: Translator with Securepay Decimal Point PROBLEM
« Reply #3 on: March 17, 2011, 04:32:51 am »
I know this is an old post but I am having the exact same issue and hoping someone may be able to tell me where to put that code or if there is another fix.