PHP 7.3 reaches end of support in December 2021 and Adobe Commerce 2.3.x reaches end of support in April 2022. We strongly recommend planning your upgrade now to Adobe Commerce 2.4.x and PHP 7.4.x to help maintain PCI compliance.
Adobe Commerce only. Learn more.

giftCardAccount query

The giftCardAccount query returns information for a specific gift card.

Syntax

giftCardAccount(code: String!): GiftCardAccount

Example usage

The following example returns information about the 01PNC9L76H4H gift card code.

Request:

1
2
3
4
5
6
7
8
9
10
query {
  giftCardAccount(input: {gift_card_code: "01PNC9L76H4H"}){
    code
    balance {
      currency
      value
    }
    expiration_date
  }
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
{
  "data": {
    "giftCardAccount": {
      "code": "01PNC9L76H4H",
      "balance": {
        "currency": "USD",
        "value": 25
      },
      "expiration_date": null
    }
  }
}

Input attributes

The giftCardAccount query requires the gift_card_code.

GiftCardAccount object

The GiftCardAccount object must contain the following attribute:

Attribute Data Type Description
gift_card_code String! The gift card code

Output attributes

The GiftCardAccount object returns the following attributes:

Attribute Data Type Description
balance Money Returns the currency and remaining balance of the gift card
code String Returns the gift card code
expiration_date String Returns the date when the gift card expires, if any

Errors

Error Description
Gift card not found The specified gift_card_code value does not exist in the giftcardaccount table, or the full amount has already been redeemed.
Field GiftCardAccountInput.gift_card_code of required type String! was not provided The value specified in the GiftCardAccountInput.gift_card_code argument is empty.