Skip to content

What Is The Best Practice for Mapping Backend Invoice Items with Xero Line Items? #198

@kamrulhasan2020

Description

@kamrulhasan2020

We're integrating with Xero using the Accounting API and need to maintain a reliable mapping between our backend InvoiceItem records and the corresponding LineItems in Xero for future updates.

Since LineItemID is only returned after invoice creation, we're looking for a robust strategy to match our local items with those returned by Xero ideally without modifying visible fields like description, and without relying on item_code (as it's already used for referencing Xero inventory items).

Questions:
What is the recommended best practice for associating backend invoice items with the corresponding Xero line items in the response after creation?

1.Is the ordering of line items preserved in the response from Xero's create_invoices() call?

Specifically, if we send line items in a known order, will created_invoice.line_items return them in the same order?

2.Can we safely rely on this order to map local items to Xero line items?

We want to ensure a reliable mapping between local and remote line items particularly to store the Xero LineItemID for update/delete operations later.

Any guidance would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions