use Apply Gift Card Changehook
hook
Returns a function to add or remove gift cards.
Caution
See security considerations if your extension retrieves gift card codes through a network call.
Anchor to useApplyGiftCardChangeuse Apply Gift Card Change()
use Apply Gift Card Change()
(change: GiftCardChange) => Promise<GiftCardChangeResult>
GiftCardChange
GiftCardAddChange | GiftCardRemoveChange
GiftCardAddChange
- type
The type of the `GiftCardChange` API.
"addGiftCard"
- code
Gift card code.
string
export interface GiftCardAddChange {
/**
* The type of the `GiftCardChange` API.
*/
type: 'addGiftCard';
/**
* Gift card code.
*/
code: string;
}
GiftCardRemoveChange
- type
The type of the `GiftCardChange` API.
"removeGiftCard"
- code
Gift card code.
string
export interface GiftCardRemoveChange {
/**
* The type of the `GiftCardChange` API.
*/
type: 'removeGiftCard';
/**
* Gift card code.
*/
code: string;
}
GiftCardChangeResult
GiftCardChangeResultSuccess | GiftCardChangeResultError
GiftCardChangeResultSuccess
- type
Indicates that the gift card change was applied successfully.
"success"
export interface GiftCardChangeResultSuccess {
/**
* Indicates that the gift card change was applied successfully.
*/
type: 'success';
}
GiftCardChangeResultError
- type
Indicates that the gift card change failed.
"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.
string
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;
}
Was this section helpful?