The Infusionsoft API is powerful, but it occasionally lets you do things that you really shouldn’t do. For this tip I’m going to talk about creating invoices that include fractions of cents. This situation most often occurs when calculating discounts or adding sales tax in your own code, and then creating the invoice via the API.
For example, you may have a product that retails for $99.99. If you discount this amount by 25%, then the product will cost $74.9925. The Infusionsoft API allows you to create an invoice for this amount, even though it contains fractions of cents that you won’t be able to collect.
In Infusionsoft the order would look like this:
If you use the API’s calculateAmountOwed
method, you’ll find out that Infusionsoft is expecting a payment of $74.99. If you take a payment for $74.99, the order will look like this in Infusionsoft:
Looks good, right? The invoice has a $0.00 balance. There isn’t any red text indicating an unpaid balance. If you use the API’s calculateAmountOwed
method, Infusionsoft will tell you that $0.00 is owed. But what if you pull the invoice up in Infusionsoft?
The Pay Status shows UNPAID in Infusionsoft. Pulling up the invoice via the API also shows a PayStatus
of 0, which indicates that the invoice isn’t paid even though TotalDue (74.99) – TotalPaid (74.99) = 0!
The moral of the story isĀ never create invoices with fractions of cents. You should always round the invoice amount to the nearest centĀ before saving the invoice to Infusionsoft.