store Credit Accountquery
query
2024-10latest
Returns a store credit account resource by ID.
Arguments
The ID of the store credit account to return.
Was this section helpful?
StoreCreditAccount possible returns
A store credit account contains a monetary balance that can be redeemed at checkout for purchases in the shop. The account is held in the specified currency and has an owner that cannot be transferred.
The account balance is redeemable at checkout only when the owner is authenticated via new customer accounts authentication.
Was this section helpful?
Code examples for QUERY: storeCreditAccount
Query Reference for QUERY: storeCreditAccount
"{\n storeCreditAccount(id) {\n # StoreCreditAccount fields\n }\n}"
Input Reference for QUERY: storeCreditAccount
Schema Reference for QUERY: storeCreditAccount
Display Examples for QUERY: storeCreditAccount
[ { "example": { "type_name": "storecreditaccount", "title": "Get a store credit account by account ID", "query_string": "query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n}", "variables": { "accountId": "gid://shopify/StoreCreditAccount/316863792" }, "response": { "data": { "storeCreditAccount": { "id": "gid://shopify/StoreCreditAccount/316863792", "balance": { "amount": "11.11", "currencyCode": "USD" } } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/resolvers/store_credit_account_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 storeCreditAccount($accountId: ID!) { storeCreditAccount(id: $accountId) { id balance { amount currencyCode } } }\",\n \"variables\": {\n \"accountId\": \"gid://shopify/StoreCreditAccount/316863792\"\n }\n}'\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", "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", "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", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query storeCreditAccount($accountId: ID!) {\n storeCreditAccount(id: $accountId) {\n id\n balance {\n amount\n currencyCode\n }\n }\n }\nQUERY;\n\n$variables = [\n \"accountId\" => \"gid://shopify/StoreCreditAccount/316863792\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "storecreditaccount", "title": "Get the first two expirable credit transactions of a store credit account", "query_string": "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}", "variables": { "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" } } } ] } } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/resolvers/store_credit_account_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 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", "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", "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", "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", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<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\n$variables = [\n \"accountId\" => \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\" => 2,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "storecreditaccount", "title": "Get the four most recent transactions of a store credit account", "query_string": "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}", "variables": { "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" } } } ] } } } }, "api_name": "admin", "minimum_api_version": "2024-07", "maximum_api_version": "unstable", "location": "/components/stored_value_instruments/store_credit/test/unit/models/graph_api/admin/resolvers/store_credit_account_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 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", "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", "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", "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", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<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\n$variables = [\n \"accountId\" => \"gid://shopify/StoreCreditAccount/669614221\",\n \"first\" => 4,\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] } ]