Version: unstable
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation giftCardCredit($id: ID!, $creditInput: GiftCardCreditInput!) { giftCardCredit(id: $id, creditInput: $creditInput) { giftCardCreditTransaction { id amount { amount currencyCode } processedAt note giftCard { id balance { amount currencyCode } } } userErrors { message field code } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/411106674\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"10\",\n \"currencyCode\": \"USD\"\n },\n \"processedAt\": \"2024-09-09T12:48:33-04:00\",\n \"note\": \"A note.\"\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation giftCardCredit($id: ID!, $creditInput: GiftCardCreditInput!) {\n giftCardCredit(id: $id, creditInput: $creditInput) {\n giftCardCreditTransaction {\n id\n amount {\n amount\n currencyCode\n }\n processedAt\n note\n giftCard {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/GiftCard/411106674\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"10\",\n \"currencyCode\": \"USD\"\n },\n \"processedAt\": \"2024-09-09T12:48:33-04:00\",\n \"note\": \"A note.\"\n }\n },\n },\n});\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 mutation giftCardCredit($id: ID!, $creditInput: GiftCardCreditInput!) {\n giftCardCredit(id: $id, creditInput: $creditInput) {\n giftCardCreditTransaction {\n id\n amount {\n amount\n currencyCode\n }\n processedAt\n note\n giftCard {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/GiftCard/411106674\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"10\",\n \"currencyCode\": \"USD\"\n },\n \"processedAt\": \"2024-09-09T12:48:33-04:00\",\n \"note\": \"A note.\"\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<\"gid://shopify/GiftCard/411106674\",\n \"creditInput\" => [\n \"creditAmount\" => [\n \"amount\" => \"10\",\n \"currencyCode\" => \"USD\",\n ],\n \"processedAt\" => \"2024-09-09T12:48:33-04:00\",\n \"note\" => \"A note.\",\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation giftCardCredit($id: ID!, $creditInput: GiftCardCreditInput!) {\n giftCardCredit(id: $id, creditInput: $creditInput) {\n giftCardCreditTransaction {\n id\n amount {\n amount\n currencyCode\n }\n processedAt\n note\n giftCard {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/GiftCard/411106674\",\n \"creditInput\": {\n \"creditAmount\": {\n \"amount\": \"10\",\n \"currencyCode\": \"USD\"\n },\n \"processedAt\": \"2024-09-09T12:48:33-04:00\",\n \"note\": \"A note.\"\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation giftCardCredit($id: ID!, $creditInput: GiftCardCreditInput!) {\n giftCardCredit(id: $id, creditInput: $creditInput) {\n giftCardCreditTransaction {\n id\n amount {\n amount\n currencyCode\n }\n processedAt\n note\n giftCard {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\n userErrors {\n message\n field\n code\n }\n }\n}"
input: { "id": "gid://shopify/GiftCard/411106674", "creditInput": { "creditAmount": { "amount": "10", "currencyCode": "USD" }, "processedAt": "2024-09-09T12:48:33-04:00", "note": "A note." } }
response: { "data": { "giftCardCredit": { "giftCardCreditTransaction": { "id": "gid://shopify/GiftCardCreditTransaction/1064273912", "amount": { "amount": "10.0", "currencyCode": "USD" }, "processedAt": "2024-09-09T16:48:33Z", "note": "A note.", "giftCard": { "id": "gid://shopify/GiftCard/411106674", "balance": { "amount": "35.0", "currencyCode": "USD" } } }, "userErrors": [] } } }