I am using the v2 bills API with the following code:
const credentials = { freeagentRoot: 'api.sandbox' };
const data = {
contact: `https://${credentials.freeagentRoot}.freeagent.com/v2/contacts/100361`,
reference: 'TEST001',
dated_on: '2021-11-29',
due_on: '2021-12-29',
bill_items: [
{
category: `https://${credentials.freeagentRoot}.freeagent.com/v2/categories/285`,
description: 'Test',
total_value: '123.45',
quantity: '1.0',
},
],
};
const { data: bill } = await axios.post(`https://${credentials.freeagentRoot}.freeagent.com/v2/bills`, data, {
headers: {
Authorization: `Bearer ${auth.access_token}`,
},
});
I get the error as mentioned above: required key bill_items not found on bill
- I don’t understand how this can be since I’m sending that array through, it’s just not being picked up.
Any ideas? Thanks!