Identifying invoice items

Is there any way to include item identifier (code) within invoice items? We need a way to get item codes from invoice items. Could you help?

Hi,

I’m afraid it’s not entirely clear what you’re asking for - what do you mean by the “item identifier” or “item code”?

On the API response to GET an Invoice, the invoice items should be included nested in the invoice object; each invoice item will have a url: field which is their unique identifier to the application. For instance:

{
  "invoice": {
    "url": "http://<api-url>/v2/invoices/1",
    "contact": "http://<api-url>/v2/contacts/1051239398",
    "dated_on": "2022-07-19",
...
    "invoice_items": [
      {
        "url": "http://<api-url>/v2/invoice_items/1",
        "position": 1,
        "description": "Stuff",
        "item_type": "Hours",
        "price": "100.0",
        "quantity": "8.0",
        "suffers_cis_deduction": false,
        "category": "http://<api-url>/v2/categories/001"
      }
    ]
  }
}

You can see the "invoice": { "invoice_items": [ { "url": "http://<api-url>/v2/invoice_items/1" } ] } field - this identifies the invoice item.

If this is not what you were looking for, please do get back in touch with more details about what you need.

Cheers,
Chris Howlett.
FreeAgent.

Hello Chris,

Every sales product has a SKU or an identifier. My question was whether there is some sort of parameter within item request / response that we can use as SKU to identify products?

We need to identify and match sales items when invoice is imported from FreeAgent into Magento.

Looking at the documentation (FreeAgent Developer Dashboard), i see that price list items have an attribute: “code”. Can this be used within invoice items?

Thank you in advance!

Serhiy

Hi Serhiy,

Thanks for clarifying - I understand now!

If your company has Price List items set up, then FreeAgent can auto-fill an Invoice Item’s fields based on a price list item - including filling the Invoice Item’s description field from the Price List item’s description. However, no link between the Invoice Item and the Price List Item is set up; and the price list item’s “code” is not copied into the invoice item.

If the item represents physical stock, you might be better with a Stock Item. Invoice Items that represent sale of Stock Items have the stock_item field, which is an API URL to the Stock Item object. The description field on the stock item object can be used as an item code.

I hope that helps?

Chris.

Good morning, Chris.

Thank you for your help!

I believe it may not be possible to achieve what we’re trying to do without having a custom parameter within invoice items (such as code or SKU).

Let me try to explain the situation.

We’ve developed an extension for Magento Adobe commerce system that connects your services and synchronises data between the two systems. We provide an option to import existing invoices from FreeAgent into Magento. In order for Magento to create an invoice we need to match order items, where SKU would be preferable attribute to have in both systems.

I agree that having stock items setup in FA would work as we get a unique stock item URL within invoice items. However, since FreeAgent API does not allow us to programmatically create stock items, it would be impossible for some clients to setup thousands of stock items inside FreeAgent manually.

I do have a workaround for now to use SKU inside item description, it’s not the cleanest solution but it works for now.

Maybe in the future you could implement a custom property inside invoice / credit note items so that we could use for SKU?

Thank you!
Serhiy

Hi Serhiy,

Right, I can understand the problem you’re trying to solve. I think you’re right that, at the moment, we don’t expose a dedicated field that would solve your problem. I’m glad you have a workaround for now, though.

I’ll raise a feature request about possibly adding a field that could be used for a SKU on invoices. This will obviously have to be considered and prioritised alongside our other features, so I can’t guarantee it will be implemented; but we do take customer use cases into account.

Thanks,
Chris.

1 Like