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.
- deactivated
At •DateTime The date and time at which the gift card was deactivated.
- 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.
- notify•Boolean!non-null
Whether the customer and recipient will be notified when the gift card is issued.
- order•Order
The order associated with the gift card. This value is
null
if the gift card was issued manually.- recipient
Attributes •GiftCard Recipient The recipient who will receive the gift card.
- template
Suffix •String The theme template used to render the gift card online.
- transactions
• GiftCard Transaction Connection The transaction history of the gift card.
- updated
At •Datenon-nullTime! The date and time at which the gift card was updated.
- balance•
- Receive a list of all Gift Card Adjustments
- Retrieves a single gift card
Examples
query GiftCardTransactionList($id: ID!, $firstTransactions: Int) {
giftCard(id: $id) {
id
balance {
amount
currencyCode
}
transactions(first: $firstTransactions) {
nodes {
amount {
amount
currencyCode
}
}
}
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/unstable/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query GiftCardTransactionList($id: ID!, $firstTransactions: Int) { giftCard(id: $id) { id balance { amount currencyCode } transactions(first: $firstTransactions) { nodes { amount { amount currencyCode } } } } }",
"variables": {
"id": "gid://shopify/GiftCard/411106674",
"firstTransactions": 5
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query GiftCardTransactionList($id: ID!, $firstTransactions: Int) {
giftCard(id: $id) {
id
balance {
amount
currencyCode
}
transactions(first: $firstTransactions) {
nodes {
amount {
amount
currencyCode
}
}
}
}
}`,
{
variables: {
"id": "gid://shopify/GiftCard/411106674",
"firstTransactions": 5
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query GiftCardTransactionList($id: ID!, $firstTransactions: Int) {
giftCard(id: $id) {
id
balance {
amount
currencyCode
}
transactions(first: $firstTransactions) {
nodes {
amount {
amount
currencyCode
}
}
}
}
}`,
"variables": {
"id": "gid://shopify/GiftCard/411106674",
"firstTransactions": 5
},
},
});
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 GiftCardTransactionList($id: ID!, $firstTransactions: Int) {
giftCard(id: $id) {
id
balance {
amount
currencyCode
}
transactions(first: $firstTransactions) {
nodes {
amount {
amount
currencyCode
}
}
}
}
}
QUERY
variables = {
"id": "gid://shopify/GiftCard/411106674",
"firstTransactions": 5
}
response = client.query(query: query, variables: variables)