What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

retrieve all refunds

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
1453 238 525

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