【Checkout UI Extensions】How to keep all digits of the gift card code

Topic summary

A developer is working with Shopify’s Checkout UI Extensions and encountering a limitation with the appliedGiftCards API, which only returns the last 4 digits of gift card codes rather than the complete code.

Core Issue:

  • Need to store full gift card codes for accurate management
  • Current API restriction prevents accessing complete codes

Proposed Solution Being Explored:

  • Store full gift card codes in CartAttributes or metafields
  • Synchronize storage with the applyGiftCardChange API
  • Conditionally save codes based on API success/failure

Technical Challenge:

  • Uncertainty about achieving synchronous execution without time lag
  • Must wait for applyGiftCardChange API response before updating metafields
  • Seeking confirmation if this approach is viable

Status: Question remains unanswered; developer is looking for guidance on implementation feasibility.

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

Checkout UI Extensions provides an appliedGiftCards API to retrieve information about the gift card being applied, but this API can only retrieve the last 4 digits of the gift card code.

We would like to keep all digits of the gift card code in Checkout UI Extensions in order to accurately manage applied gift cards.

If you have a CartAtribute or meta field that holds the full gift card code and you want to apply the gift card with the “applyGiftCardChange API”,
Is it possible to set a gift card that is being applied to a meta field, etc. synchronously with the “applyGiftCardChange API” without a time lag?
(If the API is successful in applying the gift card, we would like to keep it in the CartAtribute or meta field, and if it fails, we would like to keep it in the meta field).

Even in the above case, we need to wait for the result of the “applyGiftCardChange API” before executing the API to set the meta field.