Returns a store credit account resource by ID.


Anchor to id
id
required

The ID of the store credit account to return.


Was this section helpful?

Anchor to StoreCreditAccount
StoreCreditAccount
Access requirements

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?

Examples

Hide code
Copy
query storeCreditAccount($accountId: ID!) {
  storeCreditAccount(id: $accountId) {
    id
    balance {
      amount
      currencyCode
    }
  }
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"query": "query storeCreditAccount($accountId: ID!) { storeCreditAccount(id: $accountId) { id balance { amount currencyCode } } }",
 "variables": {
    "accountId": "gid://shopify/StoreCreditAccount/316863792"
  }
}'
const { admin } = await authenticate.admin(request);

const response = await admin.graphql(
  `#graphql
  query storeCreditAccount($accountId: ID!) {
    storeCreditAccount(id: $accountId) {
      id
      balance {
        amount
        currencyCode
      }
    }
  }`,
  {
    variables: {
      "accountId": "gid://shopify/StoreCreditAccount/316863792"
    },
  },
);

const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
  shop: "your-development-store.myshopify.com",
  access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
  session: session
)

query = <<~QUERY
  query storeCreditAccount($accountId: ID!) {
    storeCreditAccount(id: $accountId) {
      id
      balance {
        amount
        currencyCode
      }
    }
  }
QUERY

variables = {
  "accountId": "gid://shopify/StoreCreditAccount/316863792"
}

response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
  data: {
    "query": `query storeCreditAccount($accountId: ID!) {
      storeCreditAccount(id: $accountId) {
        id
        balance {
          amount
          currencyCode
        }
      }
    }`,
    "variables": {
      "accountId": "gid://shopify/StoreCreditAccount/316863792"
    },
  },
});
use Shopify\Clients\Graphql;

$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
  query storeCreditAccount($accountId: ID!) {
    storeCreditAccount(id: $accountId) {
      id
      balance {
        amount
        currencyCode
      }
    }
  }
QUERY;

$variables = [
  "accountId" => "gid://shopify/StoreCreditAccount/316863792",
];

$response = $client->query(["query" => $query, "variables" => $variables]);
Hide code
Input variables
Copy
{
  "accountId": "gid://shopify/StoreCreditAccount/316863792"
}
Hide code
Response
JSON
{
  "storeCreditAccount": {
    "id": "gid://shopify/StoreCreditAccount/316863792",
    "balance": {
      "amount": "11.11",
      "currencyCode": "USD"
    }
  }
}