AdminGiftCardsResource
This class is used to send requests to Admin Gift Card API Routes. All its method
are available in the JS Client under the medusa.admin.giftCards
property.
All methods in this class require user authentication.
Admins can create gift cards and send them directly to customers, specifying options like their balance, region, and more. These gift cards are different than the saleable gift cards in a store, which are created and managed through AdminProductsResource.
Related Guide: How to manage gift cards.
Methods
create
Create a gift card that can redeemed by its unique code. The Gift Card is only valid within one region.
Example
Parameters
The gift card to be created.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromise
ResponsePromise<AdminGiftCardsRes>Requiredupdate
Update a gift card's details.
Example
Parameters
id
stringRequiredThe attributes to update in the gift card.
customHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromise
ResponsePromise<AdminGiftCardsRes>Requireddelete
Delete a gift card. Once deleted, it can't be used by customers.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromise
ResponsePromise<DeleteResponse>Requiredretrieve
Retrieve a gift card's details.
Example
Parameters
id
stringRequiredcustomHeaders
Record<string, any>RequiredDefault: {}
Returns
ResponsePromise
ResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromise
ResponsePromise<AdminGiftCardsRes>Requiredlist
Retrieve a list of gift cards. The gift cards can be filtered by fields such as q
passed in the query
parameter. The gift cards can also paginated.
Example
To list gift cards:
By default, only the first 50
records are retrieved. You can control pagination by specifying the limit
and offset
properties:
Parameters
customHeaders
Record<string, any>RequiredDefault: {}
Filters and pagination configurations to apply on the retrieved gift cards.
Returns
ResponsePromise
ResponsePromise<AdminGiftCardsListRes>RequiredResolves to the list of gift cards with pagination fields.
ResponsePromise
ResponsePromise<AdminGiftCardsListRes>Required