-
-
Notifications
You must be signed in to change notification settings - Fork 312
Gift Cards
Joshua Harms edited this page Dec 20, 2023
·
1 revision
Developers can create a gift card with the GiftCardService
.
Gift Cards require a Shopify Plus subscription.
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
var giftCards = await service.ListAsync();
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
var giftCard = await service.CreateAsync(new GiftCard()
{
InitialValue = 100,
Code = "abc-bcd-efg"
});
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
var giftCard = await service.GetAsync(giftCardId):
Gift Cards can be disabled via that API, which makes them inactive and unusable until reenabled.
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
await service.DisableAsync(discountId);
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
int giftCardCount = await service.CountAsync();
var service = new GiftCardService(myShopifyUrl, shopAccessToken);
IEnumerable<GiftCard> giftCards = await Service.SearchAsync("code: abc-bcd-efg");
Developers can create adjustments on existing gift cards with the GiftCardAdjustmentService
.
Gift Cards require a Shopify Plus subscription and also the Gift Card Adjustment endpoint needs to be enabled on your store, contact Shopify plus support for more info.
var service = new GiftCardAdjustmentService(myShopifyUrl, shopAccessToken);
var giftCardAdjustments = await service.ListAsync(giftCardId);
var service = new GiftCardAdjustmentService(myShopifyUrl, shopAccessToken);
var giftCard = await service.CreateAsync(giftCardId, new GiftCardAdjustment()
{
Amount = -1.00,
});
var service = new GiftCardAdjustmentService(myShopifyUrl, shopAccessToken);
var giftCardAdjustment = await service.GetAsync(giftCardId, adjustmentId):