question

rmgas avatar image
rmgas asked chanel Deactivated commented

Identify all line items of an order affected by a refund

We use the API to pull sales data daily and one import piece of information is refunds. When I pull an order, I get all payments for that order and all refunds against each of the payments. By expanding the API call for the refunds to include line items, that tells me which line items were affected by the specific refund. The problem with this is that it only gives me a maximum of 100 line items affected by the refund. This is a problem as some of our orders we process have well over 100 line items. Is there a way to expand that to give me ALL line items affected by a refund?
RefundLineItems
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

chanel avatar image
chanel Deactivated answered chanel Deactivated commented
Getting back 100 line items is just the default. You can ask for more than 100 by using "limit=1000".

So in your case, to get all refunded line items in a given order, you would use "GET /v3/merchants/{mId}/orders/{orderId}/line_items?filter=refunded=true&limit=1000".
2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

rmgas avatar image rmgas commented ·
You're missing the point. I know I can pull line items for an order and filter by the refunded ones.
What I need is a way to tell which line items were affected by a specific refund.

So for example, I have Order X which has Payment Y. The customer turns around and refunds 1/3 of the items so now Payment Y has Refund Z. The customer comes back later to refund another 1/3 of the original order so now Payment Y has Refund Z and Refund R. I need a means of identifying which line items in the order were refunded with Refund Z and which were refunded with Refund R.

Expanding the refund API to include line items accomplishes this except for when there are over 100 line items. So again, I'm pulling refunds but need to know which line items are tied to a specific refund that will give me ALL line items affected, not just the first 100.
0 Likes 0 ·
chanel avatar image chanel rmgas commented ·

Sorry, but that's the limit of our API. You won't be able get more line items for a particular refund. Just refunded items from a particular order (which I've demonstrated above).

0 Likes 0 ·

Welcome to the
Clover Developer Community