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.
09-19-2017 01:23 PM
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?
09-20-2017 10:01 AM
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.
09-24-2017 12:32 PM - edited 09-24-2017 12:34 PM
Try :
amount = Convert.ToDecimal(string.Format("{0:0.00}", CurrentCartTotals["GrandTotal"]));
09-24-2017 03:37 PM
Can someone confirm whether the solution recommended here worked? We are experiencing the same issue.
07-27-2020 02:02 PM