News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Authorize.net Translator with Securepay Decimal Point PROBLEM

Started by MelanieM, June 03, 2009, 18:11:48 PM

Previous topic - Next topic

MelanieM

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: http://forum.virtuemart.net/index.php?topic=14844.msg122833#msg122833

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:

QuoteThe 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.
Melanie

drew23

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.
if(strpos($order_total,".") !== false){
//Is decimal
    $order_total_dec = number_format($order_total, 2, '.', '');
}else{
//Is NOT Decimal
$order_total_dec = $order_total . ".00";
}

gt4911b

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?

Thanks,
Keith

brandon2004

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.