Error in sales_invoice

Hello,

We are getting the below error while trying to create the sales_invoice:

[$severity] => error
[$dataCode] => UnexpectedError
[$message] => An unexpected error occurred.
[$source] =>

The data we are sending :

{"sales_invoice":{"contact_id":"27999cdef1addd14d9e94b58357b77e17","date":"2019-06-17","invoice_lines":[{"description":"Metropolitan Leather Brochure","ledger_account_id":"8000edb3bfasdfea8d3c022ace1a91e2","unit_price":1,"product_id":"73d0429ccb65ds45d1881fc8b2aa00b325","quantity":"1","total_amount":1,"unit_price_includes_tax":true}]}}

Thanks!

Parents
  • Hello,

    it is sad to hear that you have problems with the Accounting API.

    I tryed to reproduce your problem with a random (spanish) businiess. Here is my example request that works. I just added a main_address and a tax_rate_id. Please try to add these fields. In the Sales Invoice Documentation these fields are note marked as required but I think they are. Sorry, please excuse the possible inconsistency.

    {
       "sales_invoice":{
          "contact_id":"85fac8feb2a444a094e47253493adb54",
          "date":"2020-07-07",
          "invoice_lines":[
             {
                "product_id":"dba334f2172c448c98317239dd3e5c71",
                "description":"Line\\ 1",
                "ledger_account_id":"639dec41c05411ea80380647b4dff4d0",
                "quantity":2,
                "unit_price":55,
                "tax_rate_id":"ES_STANDARD"
             
    }
          
    ],
          "main_address":{
             "address_line_1":"A\\ building",
             "address_line_2":"A\\ street",
             "city":"City",
             "country_group_id":"EU",
             "country_id":"ES",
             "postal_code":90210
          
    }
       
    }
    }

    If you have problems, just ask Slight smile

    Regards, Robert

  • Hello,

    Still didn't worked.

    Here is the data, we are sending and getting the same response.

    Array
    (
    [sales_invoice] => Array
    (
    [contact_id] => 27999cdef161414d9e94b58357b77e17
    [date] => 2019-06-17
    [invoice_lines] => Array
    (
    [0] => Array
    (
    [description] => Metropolitan Leather Brochure
    [ledger_account_id] => 8000edb3bfa911ea8d3c022ace1a91e2
    [unit_price] => 10
    [product_id] => 73d0429ccb6545d1881fc8b2aa00b325
    [quantity] => 1
    [total_amount] => 10
    [unit_price_includes_tax] => 1
    [tax_rate_id] => GB_NO_TAX
    )

    )

    [main_address] => Array
    (
    [address_line_1] => 75 St Johns Close
    [address_line_2] => Knowle
    [city] => Solihull
    [region] => West Midlands
    [postal_code] => B93 0NN
    )
    )

    )

    Thanks!

  • Hi

    Apologies for the delay in getting back to you we unfortunately missed your response. 

    I have been able to re-create your issue successfully on our side.

    There is a mismatch in the tax information that is being posted. You're sending "unit_price_includes_tax" = "true" where the "tax_rate_id" = "GB_NO_TAX". This is causing the failure (albeit with an unhelpful error message) that you're experiencing.

    To remedy this you could either just omit "unit_price_includes_tax" from the request or send as "false". 

    I hope this resolves your issue and once again we apologise for the delay.

    Kind Regards

    Dan

Reply
  • Hi

    Apologies for the delay in getting back to you we unfortunately missed your response. 

    I have been able to re-create your issue successfully on our side.

    There is a mismatch in the tax information that is being posted. You're sending "unit_price_includes_tax" = "true" where the "tax_rate_id" = "GB_NO_TAX". This is causing the failure (albeit with an unhelpful error message) that you're experiencing.

    To remedy this you could either just omit "unit_price_includes_tax" from the request or send as "false". 

    I hope this resolves your issue and once again we apologise for the delay.

    Kind Regards

    Dan

Children
No Data