Is quantity always required for an invoice item?

Hello!

I seem to have run into a situation where I was successfully creating an invoice with a single item but, incorrectly, the invoice had zero value.

The data I sent to FreeAgent basically looked like this:

invoice

  • dated_on
  • payment_terms_in_days
  • ec_status
  • contact
  • currency
  • invoice_items (array of 1 item)
    • description
    • sales_tax_rate
    • price

The invoice and its item were created with all the values I passed in but the invoice’s due_value and net_value were both 0 and its status was Zero Value.

I then tried again but included a quantity of 1 in the invoice item data, and the newly created invoice had the right due_value, net_value, and status.

The docs do not say that the quantity is required – are they wrong? Or have I misunderstood?

Many thanks in advance,

Andrew Stewart

Hey, Andrew.

I can’t repro that. A null quantity will default to 0. I created a quick one with the fields you provided and it gets created in “Draft” status. So either I’m misunderstanding the issue or maybe it’s something special with the data you’re sending.

If you want to post the data you’re sending here (or send to support) I can try again. (Make sure to scrub any PII if you do post here)

Hi Pat,

Thanks for checking into this.

The issue is that the invoice gets created with a zero value despite its single invoice item having a non-zero price.

I have played around with this a bit more now, and I think it’s because the invoice item’s quantity defaults to 0, and a zero quantity means the item doesn’t contribute towards the invoice’s value. Which all makes sense when I think about it.

Perhaps the docs might be updated to mention that although the quantity isn’t required, it defaults to 0 not 1? Just a thought.

Thanks again,

Andrew

I gotcha! Yeah, updating the docs makes sense. I’ll get a card written. Thanks, Andrew.