retrieve all refunds

Haitham147
Visitor
1 0 0

Hello, how can one utilize the API Orders to retrieve all refunds within a specific date range, specifically based on the 'refund creation date'?"

Thank you!

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1408 231 484

Hey @Haitham147 , that's a great question. 

 

The orders object doesn't currently contain a specific filter for refund creation date, however you can use the updated_at date which in most cases would probably get you close to the date of the refund. 

Here's an example mutation that filters orders based on being refunded and the last updated after a specific date 

 

query {
 orders(first: 10, , query: "financial_status:refunded AND updated_at:>2023-11-01") {
   edges {
     node {
       id
       displayFinancialStatus
       processedAt
       updatedAt
       transactions(first:10) {
           id
           processedAt
           kind
       }
     }
   }
 }
}

I included the transactions in this query so you can pull in the specific date the refund was processed. 

 

This is the documentation I've used as the starting point for this query. https://shopify.dev/docs/api/admin-graphql/2023-10/queries/orders 

 

Hope that helps! 

 

- Kyle G.

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog