# StoreCreditAccount - admin-graphql - OBJECT Version: 2024-10 ## Description 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](https://shopify.dev/docs/api/customer). ### Access Scopes `read_store_credit_accounts` access scope. ## Fields * [balance](/docs/api/admin-graphql/2024-10/objects/MoneyV2): MoneyV2! - The current balance of the store credit account. * [id](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - A globally-unique ID. * [owner](/docs/api/admin-graphql/2024-10/interfaces/HasStoreCreditAccounts): HasStoreCreditAccounts! - The owner of the store credit account. ## Connections * [transactions](/docs/api/admin-graphql/2024-10/connections/StoreCreditAccountTransactionConnection): StoreCreditAccountTransactionConnection! ## Related queries * [storeCreditAccount](/docs/api/admin-graphql/2024-10/queries/storeCreditAccount) Returns a store credit account resource by ID. ## Related mutations ## Related Unions ## Examples ### Get a store credit account by account ID 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" 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}" #### Graphql Input { "accountId": "gid://shopify/StoreCreditAccount/316863792" } #### Graphql Response { "data": { "storeCreditAccount": { "id": "gid://shopify/StoreCreditAccount/316863792", "balance": { "amount": "11.11", "currencyCode": "USD" } } } } ### Get the first two expirable credit transactions of a store credit account 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" 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}" #### Graphql Input { "accountId": "gid://shopify/StoreCreditAccount/669614221", "first": 2 } #### Graphql 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" } } } ] } } } } ### Get the four most recent transactions of a store credit account 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" 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}" #### Graphql Input { "accountId": "gid://shopify/StoreCreditAccount/669614221", "first": 4 } #### Graphql 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" } } } ] } } } }