Anchor to refund
refund
query
Requires access scope or
access scope.
Returns a Refund resource by ID.
Anchor to Possible returnsPossible returns
- Anchor to RefundRefund•
The record of the line items and transactions that were refunded to a customer, along with restocking instructions for refunded line items.
Was this section helpful?
- Get refund duties
- Get the total refunded amount
- Retrieves a specific refund
Examples
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query refund($input: ID!) {
refund(id: $input) {
duties {
originalDuty {
countryCodeOfOrigin
}
amountSet {
shopMoney {
amount
}
}
}
}
}`,
{
variables: {
"input": "gid://shopify/Refund/850600470"
},
},
);
const data = await response.json();
query refund($input: ID!) {
refund(id: $input) {
duties {
originalDuty {
countryCodeOfOrigin
}
amountSet {
shopMoney {
amount
}
}
}
}
}
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 refund($input: ID!) { refund(id: $input) { duties { originalDuty { countryCodeOfOrigin } amountSet { shopMoney { amount } } } } }",
"variables": {
"input": "gid://shopify/Refund/850600470"
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
query refund($input: ID!) {
refund(id: $input) {
duties {
originalDuty {
countryCodeOfOrigin
}
amountSet {
shopMoney {
amount
}
}
}
}
}`,
{
variables: {
"input": "gid://shopify/Refund/850600470"
},
},
);
const data = await response.json();
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"query": `query refund($input: ID!) {
refund(id: $input) {
duties {
originalDuty {
countryCodeOfOrigin
}
amountSet {
shopMoney {
amount
}
}
}
}
}`,
"variables": {
"input": "gid://shopify/Refund/850600470"
},
},
});
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 refund($input: ID!) {
refund(id: $input) {
duties {
originalDuty {
countryCodeOfOrigin
}
amountSet {
shopMoney {
amount
}
}
}
}
}
QUERY
variables = {
"input": "gid://shopify/Refund/850600470"
}
response = client.query(query: query, variables: variables)
Input variables
JSON{
"input": "gid://shopify/Refund/850600470"
}
Response
JSON{
"refund": {
"duties": [
{
"originalDuty": {
"countryCodeOfOrigin": "US"
},
"amountSet": {
"shopMoney": {
"amount": "6.0"
}
}
}
]
}
}