--- title: refund - GraphQL Admin description: >- Retrieves a [refund](https://shopify.dev/docs/api/admin-graphql/latest/objects/Refund) by its ID. A refund represents a financial record of money returned to a customer from an order. It provides a comprehensive view of all refunded amounts, transactions, and restocking instructions associated with returning products or correcting order issues. Use the `refund` query to retrieve information associated with the following workflows: - Displaying refund details in order management interfaces - Building customer service tools for reviewing refund history - Creating reports on refunded amounts and reasons - Auditing refund transactions and payment gateway records - Tracking inventory impacts from refunded items A refund is associated with an [order](https://shopify.dev/docs/api/admin-graphql/latest/objects/Order) and includes [refund line items](https://shopify.dev/docs/api/admin-graphql/latest/objects/RefundLineItem) that specify which items were refunded. Each refund processes through [order transactions](https://shopify.dev/docs/api/admin-graphql/latest/objects/OrderTransaction) that handle the actual money transfer back to the customer. api_version: 2024-10 api_name: admin type: query api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/2024-10/queries/refund' md: 'https://shopify.dev/docs/api/admin-graphql/2024-10/queries/refund.txt' --- # refund query Requires `read_orders` access scope or `read_marketplace_orders` access scope. Retrieves a [refund](https://shopify.dev/docs/api/admin-graphql/latest/objects/Refund) by its ID. A refund represents a financial record of money returned to a customer from an order. It provides a comprehensive view of all refunded amounts, transactions, and restocking instructions associated with returning products or correcting order issues. Use the `refund` query to retrieve information associated with the following workflows: * Displaying refund details in order management interfaces * Building customer service tools for reviewing refund history * Creating reports on refunded amounts and reasons * Auditing refund transactions and payment gateway records * Tracking inventory impacts from refunded items A refund is associated with an [order](https://shopify.dev/docs/api/admin-graphql/latest/objects/Order) and includes [refund line items](https://shopify.dev/docs/api/admin-graphql/latest/objects/RefundLineItem) that specify which items were refunded. Each refund processes through [order transactions](https://shopify.dev/docs/api/admin-graphql/latest/objects/OrderTransaction) that handle the actual money transfer back to the customer. ## Arguments * id [ID!](https://shopify.dev/docs/api/admin-graphql/2024-10/scalars/ID) required The ID of the Refund to return. *** ## Possible returns * Refund [Refund](https://shopify.dev/docs/api/admin-graphql/2024-10/objects/Refund) The `Refund` object represents a financial record of money returned to a customer from an order. It provides a comprehensive view of all refunded amounts, transactions, and restocking instructions associated with returning products or correcting order issues. The `Refund` object provides information to: * Process customer returns and issue payments back to customers * Handle partial or full refunds for line items with optional inventory restocking * Refund shipping costs, duties, and additional fees * Issue store credit refunds as an alternative to original payment method returns * Track and reconcile all financial transactions related to refunds Each `Refund` object maintains detailed records of what was refunded, how much was refunded, which payment transactions were involved, and any inventory restocking that occurred. The refund can include multiple components such as product line items, shipping charges, taxes, duties, and additional fees, all calculated with proper currency handling for international orders. Refunds are always associated with an [order](https://shopify.dev/docs/api/admin-graphql/latest/objects/Order) and can optionally be linked to a [return](https://shopify.dev/docs/api/admin-graphql/latest/objects/Return) if the refund was initiated through the returns process. The refund tracks both the presentment currency (what the customer sees) and the shop currency for accurate financial reporting. *** Note The existence of a `Refund` object doesn't guarantee that the money has been returned to the customer. The actual financial processing happens through associated [`OrderTransaction`](https://shopify.dev/docs/api/admin-graphql/latest/objects/OrderTransaction) objects, which can be in various states, such as pending, processing, success, or failure. To determine if money has actually been refunded, check the [status](https://shopify.dev/docs/api/admin-graphql/latest/objects/OrderTransaction#field-OrderTransaction.fields.status) of the associated transactions. *** Learn more about [managing returns](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/build-return-management), [refunding duties](https://shopify.dev/docs/apps/build/orders-fulfillment/returns-apps/view-and-refund-duties), and [processing refunds](https://shopify.dev/docs/api/admin-graphql/latest/mutations/refundCreate). *** ## Examples * ### Get refund duties #### Description The following query retrieves a refund by its ID and returns the refund duties. #### Query ```graphql query refund($input: ID!) { refund(id: $input) { duties { originalDuty { countryCodeOfOrigin } amountSet { shopMoney { amount } } } } } ``` #### Variables ```json { "input": "gid://shopify/Refund/850600470" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/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" } }' ``` #### Remix ```javascript 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(); ``` #### Ruby ```ruby 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) ``` #### Node.js ```javascript 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" }, }, }); ``` #### Response ```json { "refund": { "duties": [ { "originalDuty": { "countryCodeOfOrigin": "US" }, "amountSet": { "shopMoney": { "amount": "6.0" } } } ] } } ``` * ### Get the total refunded amount #### Description The following query retrieves a refund by its ID and returns the total refunded amount. #### Query ```graphql query refund($input: ID!) { refund(id: $input) { totalRefundedSet { shopMoney { amount currencyCode } } } } ``` #### Variables ```json { "input": "gid://shopify/Refund/196417871" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query refund($input: ID!) { refund(id: $input) { totalRefundedSet { shopMoney { amount currencyCode } } } }", "variables": { "input": "gid://shopify/Refund/196417871" } }' ``` #### Remix ```javascript const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query refund($input: ID!) { refund(id: $input) { totalRefundedSet { shopMoney { amount currencyCode } } } }`, { variables: { "input": "gid://shopify/Refund/196417871" }, }, ); const data = await response.json(); ``` #### Ruby ```ruby 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) { totalRefundedSet { shopMoney { amount currencyCode } } } } QUERY variables = { "input": "gid://shopify/Refund/196417871" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query refund($input: ID!) { refund(id: $input) { totalRefundedSet { shopMoney { amount currencyCode } } } }`, "variables": { "input": "gid://shopify/Refund/196417871" }, }, }); ``` #### Response ```json { "refund": { "totalRefundedSet": { "shopMoney": { "amount": "5.75", "currencyCode": "USD" } } } } ``` * ### Retrieves a specific refund #### Query ```graphql query RefundShow($id: ID!) { refund(id: $id) { id note totalRefundedSet { presentmentMoney { amount currencyCode } } } } ``` #### Variables ```json { "id": "gid://shopify/Refund/196417871" } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query RefundShow($id: ID!) { refund(id: $id) { id note totalRefundedSet { presentmentMoney { amount currencyCode } } } }", "variables": { "id": "gid://shopify/Refund/196417871" } }' ``` #### Remix ```javascript const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query RefundShow($id: ID!) { refund(id: $id) { id note totalRefundedSet { presentmentMoney { amount currencyCode } } } }`, { variables: { "id": "gid://shopify/Refund/196417871" }, }, ); const data = await response.json(); ``` #### Ruby ```ruby 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 RefundShow($id: ID!) { refund(id: $id) { id note totalRefundedSet { presentmentMoney { amount currencyCode } } } } QUERY variables = { "id": "gid://shopify/Refund/196417871" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query RefundShow($id: ID!) { refund(id: $id) { id note totalRefundedSet { presentmentMoney { amount currencyCode } } } }`, "variables": { "id": "gid://shopify/Refund/196417871" }, }, }); ``` #### Response ```json { "refund": { "id": "gid://shopify/Refund/196417871", "note": "free shipping", "totalRefundedSet": { "presentmentMoney": { "amount": "5.75", "currencyCode": "USD" } } } } ``` [Open in GraphiQL](http://localhost:3457/graphiql?query=query%20refund\(%24input%3A%20ID!\)%20%7B%0A%20%20refund\(id%3A%20%24input\)%20%7B%0A%20%20%20%20duties%20%7B%0A%20%20%20%20%20%20originalDuty%20%7B%0A%20%20%20%20%20%20%20%20countryCodeOfOrigin%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20amountSet%20%7B%0A%20%20%20%20%20%20%20%20shopMoney%20%7B%0A%20%20%20%20%20%20%20%20%20%20amount%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%7D\&variables=%7B%0A%20%20%22input%22%3A%20%22gid%3A%2F%2Fshopify%2FRefund%2F850600470%22%0A%7D) ```javascript 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(); ``` ## Input variables JSON ```json { "input": "gid://shopify/Refund/850600470" } ``` ## Response JSON ```json { "refund": { "duties": [ { "originalDuty": { "countryCodeOfOrigin": "US" }, "amountSet": { "shopMoney": { "amount": "6.0" } } } ] } } ```