Input string was not in a correct format

Created on 31 July 2015, over 9 years ago
Updated 9 January 2025, about 1 month ago

I'm getting an error when trying to post orders to Xero.

The error message, which I understand is fairly generic, is:

Error 14 PostDataInvalidException: Input string was not in a correct format

Here's a snippet from the error log that I'm getting. My initial thinking was that the problem lay with the TaxType being empty, but having looked at the code it seems that this is unset by the module so it can be handled by Xero. But I can also see that the LineAmount is also empty.

If it's relevant, the site is using the Multicurrency module, and posting to a multi-currency Xero account. The order below was made in NZD, which is the primary currency of the Xero account.

Thanks for any help you can provided in troubleshooting this.

Array
(
    [Invoice] => Array
        (
            [Type] => ACCREC
            [Contact] => Array
                (
                    [Name] => customername
                    [EmailAddress] => customer@example.com
                )

            [Date] => 2015-07-31
            [DueDate] => 2015-07-31
            [LineAmountTypes] => Inclusive
            [LineItems] => Array
                (
                    [0] => Array
                        (
                            [LineItem] => Array
                                (
                                    [Description] => UDT001
                                    [Quantity] => 1.00
                                    [UnitAmount] => 180.85
                                    [AccountCode] => 200
                                    [TaxType] => 
                                    [TaxAmount] => 0.00
                                    [LineAmount] => 
                                )

                        )

                    [1] => Array
                        (
                            [LineItem] => Array
                                (
                                    [Description] => Courier tracked 10-14 working days 
                                    [Quantity] => 1.00
                                    [UnitAmount] => 39.88
                                    [AccountCode] => 200
                                    [TaxType] => 
                                    [TaxAmount] => 0.00
                                    [LineAmount] => 
                                )

                        )

                    [2] => Array
                        (
                            [LineItem] => Array
                                (
                                    [Description] => 
                                    [Quantity] => 1.00
                                    [UnitAmount] => -20.00
                                    [AccountCode] => 200
                                    [TaxType] => 
                                    [TaxAmount] => 0.00
                                    [LineAmount] => 
                                )

                        )

                )

            [Reference] => Order #599
            [Status] => AUTHORISED
            [SubTotal] => 200.73
            [TotalTax] => 0.00
            [Total] => 222.88
            [Url] => https://www.example.com/admin/commerce/orders/599
        )

)
πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡³πŸ‡ΏNew Zealand millionleaves

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024