Version: 2024-10
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 storeCreditAccount($accountId: ID!) { storeCreditAccount(id: $accountId) { id balance { amount currencyCode } } }\",\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/316863792\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n }`,\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/316863792\"\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 query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\nQUERY\n\nvariables = {\n \"accountId\": \"gid://shopify/StoreCreditAccount/316863792\"\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/StoreCreditAccount/316863792\",\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 query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n }`,\n {\n variables: {\n \"accountId\": \"gid://shopify/StoreCreditAccount/316863792\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n}"
input: { "accountId": "gid://shopify/StoreCreditAccount/316863792" }
response: { "data": { "storeCreditAccount": { "id": "gid://shopify/StoreCreditAccount/316863792", "balance": { "amount": "11.11", "currencyCode": "USD" } } } }
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 storeCreditAccount($accountId: ID!, $first: Int!) { storeCreditAccount(id: $accountId) { id transactions(first: $first, query: \\\"type:credit AND expires_at:*\\\") { edges { node { amount { amount currencyCode } balanceAfterTransaction { amount currencyCode } createdAt ... on StoreCreditAccountCreditTransaction { id expiresAt remainingAmount { amount currencyCode } } } } } } }\",\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 2\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, query: \"type:credit AND expires_at:*\") {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 2\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 query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, query: \"type:credit AND expires_at:*\") {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 2\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/StoreCreditAccount/669614221\",\n \"first\" => 2,\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 query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, query: \"type:credit AND expires_at:*\") {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 2\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, query: \"type:credit AND expires_at:*\") {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n }\n }\n }\n }\n}"
input: { "accountId": "gid://shopify/StoreCreditAccount/669614221", "first": 2 }
response: { "data": { "storeCreditAccount": { "id": "gid://shopify/StoreCreditAccount/669614221", "transactions": { "edges": [ { "node": { "amount": { "amount": "100.0", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "100.0", "currencyCode": "USD" }, "createdAt": "2024-01-01T00:00:00Z", "id": "gid://shopify/StoreCreditAccountCreditTransaction/870993577", "expiresAt": "2024-02-01T00:00:00Z", "remainingAmount": { "amount": "50.0", "currencyCode": "USD" } } }, { "node": { "amount": { "amount": "54.99", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "104.99", "currencyCode": "USD" }, "createdAt": "2024-01-03T00:00:00Z", "id": "gid://shopify/StoreCreditAccountCreditTransaction/870993579", "expiresAt": "2024-02-03T00:00:00Z", "remainingAmount": { "amount": "54.99", "currencyCode": "USD" } } } ] } } } }
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 storeCreditAccount($accountId: ID!, $first: Int!) { storeCreditAccount(id: $accountId) { id transactions(first: $first, sortKey: CREATED_AT, reverse: true) { edges { node { amount { amount currencyCode } balanceAfterTransaction { amount currencyCode } createdAt ... on StoreCreditAccountCreditTransaction { id expiresAt remainingAmount { amount currencyCode } } ... on StoreCreditAccountDebitTransaction { id } ... on StoreCreditAccountDebitRevertTransaction { id debitTransaction { id } } ... on StoreCreditAccountExpirationTransaction { creditTransaction { id } } } } } } }\",\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 4\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, sortKey: CREATED_AT, reverse: true) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n ... on StoreCreditAccountDebitTransaction {\n id\n }\n ... on StoreCreditAccountDebitRevertTransaction {\n id\n debitTransaction {\n id\n }\n }\n ... on StoreCreditAccountExpirationTransaction {\n creditTransaction {\n id\n }\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 4\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 query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, sortKey: CREATED_AT, reverse: true) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n ... on StoreCreditAccountDebitTransaction {\n id\n }\n ... on StoreCreditAccountDebitRevertTransaction {\n id\n debitTransaction {\n id\n }\n }\n ... on StoreCreditAccountExpirationTransaction {\n creditTransaction {\n id\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 4\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/StoreCreditAccount/669614221\",\n \"first\" => 4,\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 query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, sortKey: CREATED_AT, reverse: true) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n ... on StoreCreditAccountDebitTransaction {\n id\n }\n ... on StoreCreditAccountDebitRevertTransaction {\n id\n debitTransaction {\n id\n }\n }\n ... on StoreCreditAccountExpirationTransaction {\n creditTransaction {\n id\n }\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"accountId\": \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\": 4\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query storeCreditAccount($accountId: ID!, $first: Int!) {\n storeCreditAccount(id: $accountId) {\n id\n transactions(first: $first, sortKey: CREATED_AT, reverse: true) {\n edges {\n node {\n amount {\n amount\n currencyCode\n }\n balanceAfterTransaction {\n amount\n currencyCode\n }\n createdAt\n ... on StoreCreditAccountCreditTransaction {\n id\n expiresAt\n remainingAmount {\n amount\n currencyCode\n }\n }\n ... on StoreCreditAccountDebitTransaction {\n id\n }\n ... on StoreCreditAccountDebitRevertTransaction {\n id\n debitTransaction {\n id\n }\n }\n ... on StoreCreditAccountExpirationTransaction {\n creditTransaction {\n id\n }\n }\n }\n }\n }\n }\n}"
input: { "accountId": "gid://shopify/StoreCreditAccount/669614221", "first": 4 }
response: { "data": { "storeCreditAccount": { "id": "gid://shopify/StoreCreditAccount/669614221", "transactions": { "edges": [ { "node": { "amount": { "amount": "-90.0", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "0.0", "currencyCode": "USD" }, "createdAt": "2024-02-01T00:00:00Z", "creditTransaction": { "id": "gid://shopify/StoreCreditAccountCreditTransaction/870993581" } } }, { "node": { "amount": { "amount": "40.0", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "90.0", "currencyCode": "USD" }, "createdAt": "2024-01-03T00:00:00Z", "id": "gid://shopify/StoreCreditAccountDebitRevertTransaction/870993583", "debitTransaction": { "id": "gid://shopify/StoreCreditAccountDebitTransaction/870993582" } } }, { "node": { "amount": { "amount": "-50.0", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "50.0", "currencyCode": "USD" }, "createdAt": "2024-01-02T00:00:00Z", "id": "gid://shopify/StoreCreditAccountDebitTransaction/870993582" } }, { "node": { "amount": { "amount": "100.0", "currencyCode": "USD" }, "balanceAfterTransaction": { "amount": "100.0", "currencyCode": "USD" }, "createdAt": "2024-01-01T00:00:00Z", "id": "gid://shopify/StoreCreditAccountCreditTransaction/870993581", "expiresAt": "2024-02-01T00:00:00Z", "remainingAmount": { "amount": "90.0", "currencyCode": "USD" } } } ] } } } }