--- title: useApplyGiftCardChange description: >- Returns a function to add or remove gift cards. > Caution: > See [security considerations](/docs/api/checkout-ui-extensions/configuration#network-access) if your extension retrieves gift card codes through a network call. api_version: 2023-07 api_name: checkout-ui-extensions source_url: html: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/reductions/useapplygiftcardchange md: >- https://shopify.dev/docs/api/checkout-ui-extensions/2023-07/react-hooks/reductions/useapplygiftcardchange.md --- # use​Apply​Gift​Card​Change Returns a function to add or remove gift cards. Caution See [security considerations](https://shopify.dev/docs/api/checkout-ui-extensions/configuration#network-access) if your extension retrieves gift card codes through a network call. ## use​Apply​Gift​Card​Change() ### Returns * (change: GiftCardChange) => Promise\ ### GiftCardChange ```ts GiftCardAddChange | GiftCardRemoveChange ``` ### GiftCardAddChange * type The type of the \`GiftCardChange\` API. ```ts "addGiftCard" ``` * code Gift card code. ```ts string ``` ```ts export interface GiftCardAddChange { /** * The type of the `GiftCardChange` API. */ type: 'addGiftCard'; /** * Gift card code. */ code: string; } ``` ### GiftCardRemoveChange * type The type of the \`GiftCardChange\` API. ```ts "removeGiftCard" ``` * code Gift card code. ```ts string ``` ```ts export interface GiftCardRemoveChange { /** * The type of the `GiftCardChange` API. */ type: 'removeGiftCard'; /** * Gift card code. */ code: string; } ``` ### GiftCardChangeResult ```ts GiftCardChangeResultSuccess | GiftCardChangeResultError ``` ### GiftCardChangeResultSuccess * type Indicates that the gift card change was applied successfully. ```ts "success" ``` ```ts export interface GiftCardChangeResultSuccess { /** * Indicates that the gift card change was applied successfully. */ type: 'success'; } ``` ### GiftCardChangeResultError * type Indicates that the gift card change failed. ```ts "error" ``` * message A message that explains the error. This message is useful for debugging. It is \*\*not\*\* localized, and therefore should not be presented directly to the buyer. ```ts string ``` ```ts export interface GiftCardChangeResultError { /** * Indicates that the gift card change failed. */ type: 'error'; /** * A message that explains the error. This message is useful for debugging. * It is **not** localized, and therefore should not be presented directly * to the buyer. */ message: string; } ``` ## Related [APIs - StandardApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/standardapi) [APIs - CheckoutApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/checkoutapi) [APIs - OrderStatusApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/orderstatusapi) [APIs - CartLineItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/cartlineitemapi) [APIs - PickupPointListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuppointlistapi) [APIs - PickupLocationListApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/pickuplocationlistapi) [APIs - ShippingOptionItemApi](https://shopify.dev/docs/api/checkout-ui-extensions/apis/shippingoptionitemapi) [APIs - ExtensionTargets](https://shopify.dev/docs/api/checkout-ui-extensions/apis/extensiontargets)