Where is store Credits on order endpoint?

Heya,

I was wondering how to access a store credit Transaction linked to a return/exchange? I am on version 2025-07 of API.

for example, I am targeting an order that has a return and store credit on it like this:

query Order {
    order(id: "gid://shopify/Order/XXXXXXXXXX") {
        returns(first: 10) {
            nodes {
                closedAt
                createdAt
                id
                name
                requestApprovedAt
                status
                totalQuantity
                refunds(first: 10) {
                    nodes {
                        createdAt
                        id
                        legacyResourceId
                        note
                        updatedAt
                        totalRefunded {
                            amount
                            currencyCode
                        }
                        transactions(first: 10) {
                            nodes {
                                accountNumber
                                amount
                                authorizationCode
                                authorizationExpiresAt
                                createdAt
                                errorCode
                                formattedGateway
                                gateway
                                id
                                kind
                                manualPaymentGateway
                                manuallyCapturable
                                maximumRefundable
                                multiCapturable
                                paymentDetails
                                paymentId
                                paymentMethod
                                processedAt
                                receiptJson
                                settlementCurrency
                                settlementCurrencyRate
                                status
                                test
                                totalUnsettled
                            }
                        }
                    }
                }
                exchangeLineItems(includeRemovedItems: null, first: 10) {
                    nodes {
                        id
                        processableQuantity
                        processedQuantity
                        quantity
                        unprocessedQuantity
                        lineItem {
                            canRestock
                            currentQuantity
                            discountedTotal
                            discountedUnitPrice
                            fulfillableQuantity
                            fulfillmentStatus
                            id
                            isGiftCard
                            merchantEditable
                            name
                            nonFulfillableQuantity
                            originalTotal
                            originalUnitPrice
                            quantity
                            refundableQuantity
                            requiresShipping
                            restockable
                            sku
                            taxable
                            title
                            totalDiscount
                            unfulfilledDiscountedTotal
                            unfulfilledOriginalTotal
                            unfulfilledQuantity
                            variantTitle
                            vendor
                        }
                    }
                }
                reverseFulfillmentOrders(first: 10) {
                    nodes {
                        id
                        status
                    }
                }
            }
        }
    }
}

But the TotalRefunded is = 0.00, whereas on the order it is saying a store credit has been issued for 234.00

I believe what is happening here is that the totalRefunded field on the refund object only tracks money refunded to the original payment method, not store credit. Store credit is a separate system and is not reflected in this field. You could use the storeCreditAccount query instead.

Hey @Liam-Shopify

Sorry this doesn’t really make alot of sense to me, the order itself includes all transactions on the order (which in this case will include the store credit refund), but on the returns.refunds.transaction node, it will not show the refund that has been applied to the return?

How are you meant to associate a store credit (refund) to a specific return?

Hi again @ChrisBradley - could you query transactions instead? eg something like:

query sc { 
  storeCreditAccount(id: "gid://shopify/StoreCreditAccount/196664") { 
    transactions(first: 100) { 
      nodes { 
        amount { 
          amount 
   } 
     event 
     origin { 
       ... on OrderTransaction { 
         id 
         kind 
          } 
        } 
      } 
    }
  } 
}

The event will be ORDER_REFUND and the origin will point to a OrderTransaction. You can’t filter by the event type in the transactions query so you’d have to go through all transactions (which for most accounts should probably be manageable).

Thanks @Liam-Shopify

But how would I get the GID for the store credit (as there isn’t a store credit endpoint

For the gid of the store credit transaction linked to a refund, you would need to query all transactions on the refund and the receiptJson for each transaction.

For any store credit refund transaction there will be a credit_operation_id key in the receiptJson . You could then construct the gid from this using the following format: gid://shopify/StoreCreditAccountCreditTransaction/ <your-id-from-the-receipt> .