--- title: Gift Cards description: The API for interacting with gift cards. api_version: 2025-04 api_name: checkout-ui-extensions source_url: html: https://shopify.dev/docs/api/checkout-ui-extensions/2025-04/apis/gift-cards md: https://shopify.dev/docs/api/checkout-ui-extensions/2025-04/apis/gift-cards.md --- # Gift CardsAPI The API for interacting with gift cards. ## StandardApi The base API object provided to `purchase` extension targets. * appliedGiftCards StatefulRemoteSubscribable\ required Gift Cards that have been applied to the checkout. ### AppliedGiftCard * amountUsed The amount of the applied gift card that will be used when the checkout is completed. ```ts Money ``` * balance The current balance of the applied gift card prior to checkout completion. ```ts Money ``` * lastCharacters The last four characters of the applied gift card's code. ```ts string ``` ```ts export interface AppliedGiftCard { /** * The last four characters of the applied gift card's code. */ lastCharacters: string; /** * The amount of the applied gift card that will be used when the checkout is completed. */ amountUsed: Money; /** * The current balance of the applied gift card prior to checkout completion. */ balance: Money; } ``` ### Money * amount The price amount. ```ts number ``` * currencyCode The ISO 4217 format for the currency. ```ts CurrencyCode ``` ```ts export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' ``` ## CheckoutApi The API object provided to `purchase.checkout` extension targets. * applyGiftCardChange (change: GiftCardChange) => Promise\ required Performs an update on the gift cards. It resolves when gift card change have been negotiated and results in an update to the value retrieved through the [`appliedGiftCards`](https://shopify.dev/docs/api/checkout-ui-extensions/apis/gift-cards#standardapi-propertydetail-appliedgiftcards) property. 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. Note This method will return an error if the buyer is using an accelerated checkout method, such as Apple Pay, Google Pay, or Meta Pay. ### GiftCardChange ```ts GiftCardAddChange | GiftCardRemoveChange ``` ### GiftCardAddChange * code Gift card code. ```ts string ``` * type The type of the \`GiftCardChange\` API. ```ts "addGiftCard" ``` ```ts export interface GiftCardAddChange { /** * The type of the `GiftCardChange` API. */ type: 'addGiftCard'; /** * Gift card code. */ code: string; } ``` ### GiftCardRemoveChange * code The full gift card code, or the last four digits of the code. ```ts string ``` * type The type of the \`GiftCardChange\` API. ```ts "removeGiftCard" ``` ```ts export interface GiftCardRemoveChange { /** * The type of the `GiftCardChange` API. */ type: 'removeGiftCard'; /** * The full gift card code, or the last four digits of the 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 * 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 ``` * type Indicates that the gift card change failed. ```ts "error" ``` ```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; } ``` ## use​Applied​Gift​Cards() Returns the current gift cards applied to the cart. ### Returns * AppliedGiftCard\[] ### AppliedGiftCard * amountUsed The amount of the applied gift card that will be used when the checkout is completed. ```ts Money ``` * balance The current balance of the applied gift card prior to checkout completion. ```ts Money ``` * lastCharacters The last four characters of the applied gift card's code. ```ts string ``` ```ts export interface AppliedGiftCard { /** * The last four characters of the applied gift card's code. */ lastCharacters: string; /** * The amount of the applied gift card that will be used when the checkout is completed. */ amountUsed: Money; /** * The current balance of the applied gift card prior to checkout completion. */ balance: Money; } ``` ### Money * amount The price amount. ```ts number ``` * currencyCode The ISO 4217 format for the currency. ```ts CurrencyCode ``` ```ts export interface Money { /** * The price amount. */ amount: number; /** * The ISO 4217 format for the currency. * @example 'CAD' for Canadian dollar */ currencyCode: CurrencyCode; } ``` ### CurrencyCode ```ts 'AED' | 'AFN' | 'ALL' | 'AMD' | 'ANG' | 'AOA' | 'ARS' | 'AUD' | 'AWG' | 'AZN' | 'BAM' | 'BBD' | 'BDT' | 'BGN' | 'BHD' | 'BIF' | 'BMD' | 'BND' | 'BOB' | 'BOV' | 'BRL' | 'BSD' | 'BTN' | 'BWP' | 'BYN' | 'BZD' | 'CAD' | 'CDF' | 'CHE' | 'CHF' | 'CHW' | 'CLF' | 'CLP' | 'CNY' | 'COP' | 'COU' | 'CRC' | 'CUC' | 'CUP' | 'CVE' | 'CZK' | 'DJF' | 'DKK' | 'DOP' | 'DZD' | 'EGP' | 'ERN' | 'ETB' | 'EUR' | 'FJD' | 'FKP' | 'GBP' | 'GEL' | 'GHS' | 'GIP' | 'GMD' | 'GNF' | 'GTQ' | 'GYD' | 'HKD' | 'HNL' | 'HRK' | 'HTG' | 'HUF' | 'IDR' | 'ILS' | 'INR' | 'IQD' | 'IRR' | 'ISK' | 'JMD' | 'JOD' | 'JPY' | 'KES' | 'KGS' | 'KHR' | 'KMF' | 'KPW' | 'KRW' | 'KWD' | 'KYD' | 'KZT' | 'LAK' | 'LBP' | 'LKR' | 'LRD' | 'LSL' | 'LYD' | 'MAD' | 'MDL' | 'MGA' | 'MKD' | 'MMK' | 'MNT' | 'MOP' | 'MRU' | 'MUR' | 'MVR' | 'MWK' | 'MXN' | 'MXV' | 'MYR' | 'MZN' | 'NAD' | 'NGN' | 'NIO' | 'NOK' | 'NPR' | 'NZD' | 'OMR' | 'PAB' | 'PEN' | 'PGK' | 'PHP' | 'PKR' | 'PLN' | 'PYG' | 'QAR' | 'RON' | 'RSD' | 'RUB' | 'RWF' | 'SAR' | 'SBD' | 'SCR' | 'SDG' | 'SEK' | 'SGD' | 'SHP' | 'SLL' | 'SOS' | 'SRD' | 'SSP' | 'STN' | 'SVC' | 'SYP' | 'SZL' | 'THB' | 'TJS' | 'TMT' | 'TND' | 'TOP' | 'TRY' | 'TTD' | 'TWD' | 'TZS' | 'UAH' | 'UGX' | 'USD' | 'USN' | 'UYI' | 'UYU' | 'UYW' | 'UZS' | 'VES' | 'VND' | 'VUV' | 'WST' | 'XAF' | 'XAG' | 'XAU' | 'XBA' | 'XBB' | 'XBC' | 'XBD' | 'XCD' | 'XDR' | 'XOF' | 'XPD' | 'XPF' | 'XPT' | 'XSU' | 'XTS' | 'XUA' | 'XXX' | 'YER' | 'ZAR' | 'ZMW' | 'ZWL' ``` ## use​Apply​Gift​Card​Change() Returns a function to add or remove gift cards. ### Returns * (change: GiftCardChange) => Promise\ ### GiftCardChange ```ts GiftCardAddChange | GiftCardRemoveChange ``` ### GiftCardAddChange * code Gift card code. ```ts string ``` * type The type of the \`GiftCardChange\` API. ```ts "addGiftCard" ``` ```ts export interface GiftCardAddChange { /** * The type of the `GiftCardChange` API. */ type: 'addGiftCard'; /** * Gift card code. */ code: string; } ``` ### GiftCardRemoveChange * code The full gift card code, or the last four digits of the code. ```ts string ``` * type The type of the \`GiftCardChange\` API. ```ts "removeGiftCard" ``` ```ts export interface GiftCardRemoveChange { /** * The type of the `GiftCardChange` API. */ type: 'removeGiftCard'; /** * The full gift card code, or the last four digits of the 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 * 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 ``` * type Indicates that the gift card change failed. ```ts "error" ``` ```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 [![](https://shopify.dev/images/icons/32/blocks.png)![](https://shopify.dev/images/icons/32/blocks-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [ReferenceTargets](https://shopify.dev/docs/api/checkout-ui-extensions/targets) [![](https://shopify.dev/images/icons/32/apps.png)![](https://shopify.dev/images/icons/32/apps-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/components) [ReferenceComponents](https://shopify.dev/docs/api/checkout-ui-extensions/components) [![](https://shopify.dev/images/icons/32/gear.png)![](https://shopify.dev/images/icons/32/gear-dark.png)](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [ReferenceConfiguration](https://shopify.dev/docs/api/checkout-ui-extensions/configuration) [![](https://shopify.dev/images/icons/32/tutorial.png)![](https://shopify.dev/images/icons/32/tutorial-dark.png)](https://shopify.dev/apps/checkout) [LearnTutorials](https://shopify.dev/apps/checkout)