Accurately calculating line item transaction data

sam12341
Tourist
11 0 2

i"m merging data from a shopify store with 2 other platforms to create a master dataset that will consist of a line for each receipt-line. The other two platforms create a new line every time an action happens, however the shopify API returns refunds as part of an order and they don't always apply to a particular line item. I'd like to make sure i'm calculating correctly when generating data to merge with the other two datasets. 

 

There is order level refunds data as well as line-item data thats sometimes contained in that field. Does anyone have any thoughts on how best to generate accurate line-item data from the orders endpoint? 

 

here's a very simplified version of what i'm trying to generate: 

datetime | variant_id | price | quantity | extended 

5/20/20   |        12345|    1.99 |               1|   1.99

5/21/20    |        12345|    1.99 |              -1|  -1.99

0 Likes