gift Cardquery
query
2024-10latest
Requires read
access scope.
Returns a gift card resource by ID.
Arguments
The ID of the GiftCard to return.
Was this section helpful?
GiftCard possible returns
Represents an issued gift card.
Was this section helpful?
Code examples for QUERY: giftCard
Query Reference for QUERY: giftCard
"{\n giftCard(id) {\n # GiftCard fields\n }\n}"
Input Reference for QUERY: giftCard
Schema Reference for QUERY: giftCard
Display Examples for QUERY: giftCard
[ { "example": { "type_name": "giftcard", "title": "Get a gift card by ID", "description": "The following query takes a gift card ID, and returns the balance of the gift card.", "query_string": "query {\n giftCard(id: \"gid://shopify/GiftCard/411106674\") {\n balance {\n amount\n currencyCode\n }\n }\n}", "query_arguments": { "id": "gid://shopify/GiftCard/411106674" }, "response": { "data": { "giftCard": { "balance": { "amount": "25.0", "currencyCode": "USD" } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/gift_cards/test/unit/graph_api/admin/gift_card_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { giftCard(id: \\\"gid://shopify/GiftCard/411106674\\\") { balance { amount currencyCode } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n giftCard(id: \"gid://shopify/GiftCard/411106674\") {\n balance {\n amount\n currencyCode\n }\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n giftCard(id: \"gid://shopify/GiftCard/411106674\") {\n balance {\n amount\n currencyCode\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n giftCard(id: \"gid://shopify/GiftCard/411106674\") {\n balance {\n amount\n currencyCode\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n giftCard(id: \"gid://shopify/GiftCard/411106674\") {\n balance {\n amount\n currencyCode\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the GiftCard to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/GiftCard/411106674\"", "typeKind": "QUERY" } ] } ]