How can I get gift card info when using the orders webhooks?

egillanton
Shopify Partner
11 2 2

I am trying to get information on how much was paid with a gift card when I receive an order through the orders webhook.

 

 The only information within the webhook payload that seems to contain any information about the gift card

is the following:

payment_gateway_names: [ 'gift_card', 'bogus' ].

 

But for the integrated bookkeeping system, I need the amount spent and potentially the gift card ID. 

 

I have also looked into the orders when a gift card is purchased. The line item has gift_card set to true. but what is its ID within Shopify that I can map it to when a customer decides to use it? 

Replies 3 (3)
HunkyBill
Shopify Expert
4843 60 546

A gift card is a product. When you say you examine an order, and you see the line item with the attribute gift_card set to true, you are now staring at most of the info you are asking for. For one, you get the ID of that gift card. There are many IDs in Shopify, but in this case, the product ID and the line item ID could be of use in reporting. Also, when line items are assigned, usually you get the currency, and totals. Again. Useful info.

 

If you feel you are not seeing enough information, you can always make API calls to get even more details. Things like the order transactions are often useful for accounting purposes.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
egillanton
Shopify Partner
11 2 2

You are correct, when I buy a gift card it appears like any other product with a unique id etc.

But I want to be able to know what gift card is being used when an order is paid partially or fully with a gift card. I will look into the transactions objects in the API. Thank you  

HunkyBill
Shopify Expert
4843 60 546

To know what gift card was used, you are free to use the API to do a GET on the resource that matches, in this case a product. All the details of that product should be available to you when you present that ID and ask for details.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com