Get line items from order API?

I have ordered the gift card using order API, my application needs to fetch gift cards using order detail API.
How can get ordered gift cards using order API?

If they’re catalog_object_ids you can use the Catalog API to get the item detail for the gift card orders by retrieving the catalog object by the ID that’s in the order. :slightly_smiling_face:

I have called /v2/catalog/list API to get catalogs.
In response not have the type GIFT CARD catalog, So I have pass the ID of type ITEM in order catalog_object_id, but getting error
GIFT_CARD line items cannot reference a catalog object.

Gift cards sold from the POS app don’t have a catalog_object_id in the order. The line order will have all the information in the order. Do you have an example order_id that you’re looking at? :slightly_smiling_face:

I need to fetch the gift cards from the order using order_id but there is no way I can find how to do it, my application receives the webhook after the order create and except the order have gift cards info, like giftcard_number or by calling the other API using order_id, but not found any API.

The below order_id I have created to buy gift card and create ACTIVATE activity using order_id and line_item uid
OrderID : KT6jrzXRylWSh6UYB70wz1h6N8IZY

The uid isn’t returned by the Catalog API and is a unique ID that identifies the line item only within this order. With Gift card sales on the POS a catalog_object_id isn’t assigned to the gift card item so there isn’t a catalog object that can be returned. All the information is in the line item itself. :slightly_smiling_face:

I have tried using the catalog_object_id from the catalog list API which is DS4EOYMA2M3BVOL4FXHPIK6G also by random catalog_object_id. In both cases, it says error code 400 and message GTFT_CARD` line items cannot reference a catalog object.. As well line_items do not have gift card information like giftcard_number even after the gift card assigned to order and line_item by gift card ACTIVATE activity

That catalog_object_id is an item_id. Orders only accept variation_ids. Also if you’re creating an order for that item why are you setting the type GTFT_CARD? Are you trying to pay for items using a gift card or sell gift cards? :slightly_smiling_face:

I am trying to sell the gift card, So I have selected type GIFT_CARD as a line_item.
If Order only accepts variation_ids from where do we get this.
My problem is to get gift card information like giftcard_number, and amount whether it’s buying or redeeming an order.

Okay, perfect! You’ll need to use the Gift Cards API. This will allow you to get all the gift card information, create the order, and pay for the gift cards using the APIs. :slightly_smiling_face:

I think you misunderstand the query, I need to get the gift card information using order_id if the user orders the gift card, is there any way to do it.

The information about the gift card will be in the order if it’s a Square Gift card that’s sold from one of the Square provided means of selling gift cards. So you won’t need to call the Catalog API to get the information. :slightly_smiling_face: