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.
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.
export function useApplyGiftCardChange< Target extends RenderExtensionTarget = RenderExtensionTarget, >(): (change: GiftCardChange) => Promise<GiftCardChangeResult> { const api = useApi<Target>(); if ('applyGiftCardChange' in api) { return api.applyGiftCardChange; } throw new ExtensionHasNoMethodError( 'applyGiftCardChange', api.extension.target, ); }
GiftCardAddChange | GiftCardRemoveChange
The type of the `GiftCardChange` API.
Gift card code.
The type of the `GiftCardChange` API.
Gift card code.
GiftCardChangeResultSuccess | GiftCardChangeResultError
Indicates that the gift card change was applied successfully.
Indicates that the gift card change failed.
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.