Posts: 2
Registered: ‎09-19-2017

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. 

All Star
Posts: 699
Registered: ‎11-03-2016

Re: Four decimal digits in payment amount

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?

Posts: 2
Registered: ‎09-19-2017

Re: Four decimal digits in payment amount

[ Edited ]



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. 


Posts: 491
Topics: 0
Kudos: 96
Blog Posts: 0
Ideas: 0
Solutions: 41
Registered: ‎04-28-2017

Re: Four decimal digits in payment amount

Try :

amount = Convert.ToDecimal(string.Format("{0:0.00}", CurrentCartTotals["GrandTotal"]));
Powered by -
Certified developers
Posts: 1
Registered: ‎07-27-2020

Re: Four decimal digits in payment amount

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