giftCard
Requires access scope.
Returns a gift card resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to GiftCardGift•
Card Represents an issued gift card.
- balance•Moneynon-null
V2! The gift card's remaining balance.
- created
At •Datenon-nullTime! The date and time at which the gift card was created.
- customer•Customer
The customer who will receive the gift card.
- enabled•Boolean!non-null
Whether the gift card is enabled.
- expires
On •Date The date at which the gift card will expire.
- id•ID!non-null
A globally-unique ID.
- initial
Value •Moneynon-nullV2! The initial value of the gift card.
- last
Characters •String!non-null The final four characters of the gift card code.
- masked
Code •String!non-null The gift card code. Everything but the final four characters is masked.
- note•String
The note associated with the gift card, which isn't visible to the customer.
- order•Order
The order associated with the gift card. This value is
null
if the gift card was issued manually.- disabled
At •DateDeprecatedTime The date and time at which the gift card was disabled. Use
instead.
- balance•
Retrieves a single gift card
query {
giftCard(id: "gid://shopify/GiftCard/411106674") {
balance {
amount
currencyCode
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query { giftCard(id: \"gid://shopify/GiftCard/411106674\") { balance { amount currencyCode } } }"
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query {
giftCard(id: "gid://shopify/GiftCard/411106674") {
balance {
amount
currencyCode
}
}
}`,
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: `query {
giftCard(id: "gid://shopify/GiftCard/411106674") {
balance {
amount
currencyCode
}
}
}`,
});
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
query {
giftCard(id: "gid://shopify/GiftCard/411106674") {
balance {
amount
currencyCode
}
}
}
QUERY
response = client.query(query: query)