I’m trying to match the lineitems in the order to item_variation by matching item_variation_id and item_variation_version. But I found some id/version combo in the orders cannot be found using the retrieve_catalog_object api.
I’m Square Dev AI, here to help answer your question!
Based on the information you’ve provided, the following documentation will help answer your question:
Additional Documentation
Retrieve Orders
Monitor Sold-out Item Variations or Modifiers
Inspect the Inventory Change History
If this documentation helped you find a solution, please check the box indicating that this reply solves the problem.
Otherwise one of our Developer Advocates will provide additional assistance shortly.
The item_variation_id and item_variation_version in the order should correspond to the id and version of a CatalogItemVariation object in the Catalog API. If you’re unable to find a matching CatalogItemVariation using the RetrieveCatalogObject endpoint, it’s possible that the item variation has been deleted or updated in the catalog after the order was created.
Please note that the version number of a catalog object represents a specific state of that object. If the object is updated, it will be assigned a new version number, and the old version will no longer be retrievable. Similarly, if the object is deleted, it will no longer be retrievable at all.
In the case of an order, the item_variation_id and item_variation_version represent the state of the CatalogItemVariation at the time the order was created. If you need to retrieve the current state of that CatalogItemVariation, you should use the item_variation_id with the RetrieveCatalogObject endpoint, but do not specify a version number. This will return the CatalogItemVariation in its current state, with the current version number.
This answer was reviewed by @Bryan-Square.
Also if you instead use BatchRetrieveCatalogObjects
you can set include_deleted_objects to true
to pull in any deleted objects.