Anchor to storeCreditAccountstore
storeCreditAccount
query
Returns a store credit account resource by ID.
Anchor to Arguments
Arguments
- •ID!required
The ID of the store credit account to return.
Was this section helpful?
Anchor to Possible returnsPossible returns
- Anchor to StoreCreditAccountStore•
Credit Account 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?
- Get a store credit account by account ID
- Get the first two expirable credit transactions of a store credit account
- Get the four most recent transactions of a store credit account
Examples
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();
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();
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"
},
},
});
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)
Input variables
JSON{
"accountId": "gid://shopify/StoreCreditAccount/316863792"
}
Response
JSON{
"storeCreditAccount": {
"id": "gid://shopify/StoreCreditAccount/316863792",
"balance": {
"amount": "11.11",
"currencyCode": "USD"
}
}
}