Purchased gift card id

Topic summary

A developer needs to retrieve gift card information from Shopify’s GraphQL order or fulfillment queries to generate invoices for gift card sales. They’re asking if this functionality will be added, or if filtering the GiftCards query by order ID is possible.

Current limitation:

  • Gift card details aren’t directly exposed through order/fulfillment queries due to security design.

Suggested workarounds:

  1. Use the GiftCards query and cross-reference by note, customer, or order date range
  2. Store gift card IDs in order metafields at purchase time via custom app or checkout script
  3. Set up webhook automation (orders/paid) to log order and gift card data to external reporting tools

The responder offered to review the developer’s workflow to help implement a clean data-linking solution. The issue remains unresolved pending official API enhancement or implementation of a workaround.

Summarized with AI on October 24. AI used: claude-sonnet-4-5-20250929.

Hi, will there soon be a way to get more information about a purchased gift card from the order GraphQL query? Or at least from the fulfilments query?

We need this in order to generate an invoice for the gift card sale — we don’t need any information about whether the card has been used.

Or, for example, could it be made possible to filter the GiftCards query by the order.id?

Thanks in advance

Hello MilekNP, You’re right at the moment, Shopify’s GraphQL Admin API doesn’t expose detailed gift card info directly through the order or fulfillment queries. The data separation is intentional for security reasons, but there are still a couple of reliable workarounds:

  1. Cross-reference via GiftCard API – You can use the GiftCards query and match by note, customer, or even the created date range of the order to locate the corresponding card record.

  2. Store custom data at purchase – When a gift card is generated (through a custom app or checkout script), you can save the giftCard.id or code in the order’s metafields. That way, you’ll always have a reference for reporting or invoicing later.

  3. Automated invoice generation – Some stores handle this by using a webhook (orders/paid) that triggers a custom script to log both order + gift card details into a reporting app or Google Sheet.

If you’d like, I can take a quick look at your current workflow or setup and show how to link the data cleanly