Vote up!
Vote down!

why order total is x 100


I am working with a custom payment gateway that requires to receive the total amount (and other data) by GET parameter, then when is inserted the value of the order total, the value received is multiplied by 100: so for example if the total amount on Checkout is 5 $USD, the total amount handled by the commerce_order_total attribute is 500 and this is the value sent to the payment gateway.

this is the code that I am using:

$wrapper = entity_metadata_wrapper('commerce_order', $order);
$total_amount_value = $wrapper->commerce_order_total->amount->value();

I have reviewed in several issues and seems that this is because the value is stored in cents and not in dollars (or I am wrong?), then my question is: there is no API function to convert cents to dollars?, or is safe just to divide by 100 the total? or there is some kind of standard from payment gateways to receive in cents?

Asked by: cigocf
on March 25, 2013

1 Answer