I’ve discovered something that I would consider to be a bug when comparing the reponse of the /invoices and /invoices/:id endpoints.
Hitting this endpoint, if an “invoice” is actually a credit note, I get back a nested property called credit_note_items, however invoices have a nested property of invoice_items.
If I then take the ID of the credit note and retrieve it via this endpoint, the nested property is now invoice_items and NOT credit_note_items.
Personally, I don’t want to hit multiple endpoints in order to combine invoices and credit notes, so the convenience of /invoices is helpful. What’s not helpful is the variable response - shouldn’t there be consistency and only give me the invoice_items property?
I can understand why the property would be credit_note_items if I was retrieving the resources via the /credit_notes endpoint, but when I’m retrieving them as invoices, this seems like a bug.
I’ve now built in logic at my end to handle this oddity, but I’d suggest this is a bug that needs ironing out.