Getting "line_items.currency_tax_amount" error

Hello,

I'm trying to post an invoice to sage online with taxes in Canada. My JSON looks like this:

{
  "sales_invoice": {
    "date": "2020-08-25",
    "tax_amount": 41.52,
    "delivery_address": {
      "city": "Laval",
      "address_line_1": "123 abc ville b100",
      "address_line_2": "",
      "postal_code": "J7k 1X8",
      "region": "CA-QC",
      "country_id": "CA"
    },
    "due_date": "2020-08-28",
    "contact_id": "04d2c19c7f96441ab9f844c486e8089c",
    "shipping_net_amount": 0,
    "shipping_tax_amount": 0,
    "currency_tax_amount": 0,
    "total_amount": 318.76,
    "main_address": {
      "city": "Laval",
      "address_line_1": "123 abc ville b100",
      "address_line_2": "",
      "postal_code": "J7k 1X8",
      "region": "CA-QC",
      "country_id": "CA"
    },
    "tax_address_region_id": "CA-QC",
    "net_amount": 277.24,
    "invoice_number": "1",
    "shipping_total_amount": 0,
    "invoice_lines": [
      {
        "tax_rate_id": "CA_GST_QST",
        "ledger_account_id": "dee5f33754cd4ffd9ab63e91ce988889",
        "quantity": 2,
        "total_amount": 277.24,
        "unit_price_includes_tax": false,
        "service_id": "25f7fc9e284b4a9b97fbe824bcabdccc",
        "description": "ground_spike-fix.stl",
        "unit_price": 138.62
      }
    ],
    "currency_id": "CAD",
    "invoice_number_prefix": "I"
  }
}

The API returns the following error:

[{"$severity":"error","$dataCode":"RecordInvalid","$message":"This field is required.","$source":"line_items.currency_tax_amount"}]

I can't find any documentation on the "line_items.currency_tax_amount" anywhere and even if I put it in the line item of the invoice, I still get the same error.

Any idea how to fix this ?

Thanks,

Alex

  • Hi Alex,

    I have been able to re-create your issue using an almost identical request to yours. It can be resolved by simply removing "tax_amount" from the main body of the request and adding to to the line items instead. 

    Below is what your new request should look like:

    {
      "sales_invoice": {
        "date": "2020-08-25",
        "delivery_address": {
          "city": "Laval",
          "address_line_1": "123 abc ville b100",
          "address_line_2": "",
          "postal_code": "J7k 1X8",
          "region": "CA-QC",
          "country_id": "CA"
        },
        "due_date": "2020-08-28",
        "contact_id": "04d2c19c7f96441ab9f844c486e8089c",
        "shipping_net_amount": 0,
        "shipping_tax_amount": 0,
        "currency_tax_amount": 0,
        "total_amount": 318.76,
        "main_address": {
          "city": "Laval",
          "address_line_1": "123 abc ville b100",
          "address_line_2": "",
          "postal_code": "J7k 1X8",
          "region": "CA-QC",
          "country_id": "CA"
        },
        "tax_address_region_id": "CA-QC",
        "net_amount": 277.24,
        "invoice_number": "1",
        "shipping_total_amount": 0,
        "invoice_lines": [
          {
            "tax_rate_id": "CA_GST_QST",
            "ledger_account_id": "dee5f33754cd4ffd9ab63e91ce988889",
            "quantity": 2,
            "total_amount": 277.24,
            "tax_amount": 41.52
            "unit_price_includes_tax": false,
            "service_id": "25f7fc9e284b4a9b97fbe824bcabdccc",
            "description": "ground_spike-fix.stl",
            "unit_price": 138.62
          }
        ],
        "currency_id": "CAD",
        "invoice_number_prefix": "I"
      }
    }

    Please let us know if you are still having issues. We will investigate further why that specific error is being shown as it is clearly misleading. 

    Kind Regards 

    Dan