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 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.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromiseResponsePromise<AdminGiftCardsRes>Requiredupdate
Update a gift card's details.
Example
Parameters
idstringRequiredThe attributes to update in the gift card.
customHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromiseResponsePromise<AdminGiftCardsRes>Requireddelete
Delete a gift card. Once deleted, it can't be used by customers.
Example
Parameters
idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<DeleteResponse>RequiredResolves to the deletion operation's details.
ResponsePromiseResponsePromise<DeleteResponse>Requiredretrieve
Retrieve a gift card's details.
Example
Parameters
idstringRequiredcustomHeadersRecord<string, any>RequiredDefault: {}
Returns
ResponsePromiseResponsePromise<AdminGiftCardsRes>RequiredResolves to the gift card's details.
ResponsePromiseResponsePromise<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
customHeadersRecord<string, any>RequiredDefault: {}
Filters and pagination configurations to apply on the retrieved gift cards.
Returns
ResponsePromiseResponsePromise<AdminGiftCardsListRes>RequiredResolves to the list of gift cards with pagination fields.
ResponsePromiseResponsePromise<AdminGiftCardsListRes>Required