cancel
Showing results for 
Search instead for 
Did you mean: 

Four decimal digits in payment amount

We're being forced to use the hosted payment form and while the information is passing over properly, the amount is always showing with four decimal digits. Is there a way to fix this? It looks stupid when you're dealing with dollars and cents. 

ncseric
Member
4 REPLIES 4

I've personally never seen this.

 

Can you post a screenshot?

Can you give me any steps to reproduce?

What is the information you're sending in your token request so I can try to recreate on my side?

Aaron
All Star

Screenshot: https://goo.gl/jhLBZf

 

The code is about as generic as you get -- C#:

 

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(), // authorize capture only
amount = Convert.ToDecimal(CurrentCartTotals["GrandTotal"]),
refTransId = trans.pkPolicyApplicationID.ToString(),
customer = new customerDataType { email = trans.ContactEmail},
billTo = new customerAddressType
{
firstName = trans.BillingFirstName,
lastName = trans.BillingLastName,
address = trans.BillingAddress1,
city = trans.BillingCity,
state = trans.BillingState,
zip = trans.BillingPostalCode,
country = "USA",
phoneNumber = trans.ContactPhone
},
};

 

The trans object is a custom one containing transaction details. The transactionRequestType requires a decimal, so even if I forced the decimal digits to 2, it would still pass as a decimal and the formatting would be lost. 

 

Try :

amount = Convert.ToDecimal(string.Format("{0:0.00}", CurrentCartTotals["GrandTotal"]));
Powered by NexWebSites.com -
Certified Authorize.net developers

Can someone confirm whether the solution recommended here worked? We are experiencing the same issue.