Content >

Edit Gift Card

Edit Gift Card

Feature Feature: Gift Cards
Editions Editions: Cloud, Corporate*


POS provides the giftcardEdit endpoint to enable the addition, removal and replacement of the codes that are associated with an existing gift card.

This endpoint requires the EditGiftCard permission.

By default this endpoint permission is not granted. It should only be granted to trusted API clients, as it can be misused to access funds on existing gift cards. Only enable when you can guarantee that the API client cannot be compromised.

This endpoint identifies the gift card to update with the gift card’s internal ID. If you use this endpoint ensure that your client obtains the internal ID when calling the giftcardAdd mutation or querying giftcard.

Examples

Add Code

Add a code to an existing gift card:

mutation EditCard {
  giftcardEdit(
    giftcard: {
      id: "30004",
      addPersonalCode: true,
      memberId: "C000000212"
  } ) {
    id
    memberId
    codes {
      codeType
      code
      expiresOn
    }
  }
}

This example adds a personal code to the card (e.g. a card that already has a physical or external code).

  • A member ID must be supplied when adding a personal code.

Revoke Code

Remove a code from an existing gift card:

mutation EditCard {
  giftcardEdit(giftcard: {
    id: "30004",
    revokePhysicalCode: true
  }) {
    id
    memberId
    codes {
      codeType
      code
      expiresOn
    }
  }
}

This example removes a physical code from a card.

Revoke Code

Replacing a code is the same as adding a code; the behavior changes depending only on whether a code of the same type already exists on the card.

  • The supplied member ID must match the existing member ID associated with a card – you cannot change the card owner.

Replace Code

Multiple changes can be applied in the same endpoint call:

mutation EditCard {
  giftcardEdit(
    giftcard: {
      id: "30004",
      revokePhysicalCode: true,
      addPersonalCode: true,
      memberId: "C000000212"
  } ) {
    id
    memberId
    codes {
      codeType
      code
      expiresOn
    }
  }
}

This example revokes a physical code and adds/replaces a personal code.