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.

Matching Line Items to transactions

Matching Line Items to transactions

srcb
Shopify Partner
10 0 2

I wanted to know if there is a way to match which Line Items are covered by which transactions? Or at least which agreements are covered by which transactions?  

Replies 3 (3)

srcb
Shopify Partner
10 0 2

Anybody? How do I match agreements to transactions? How do I find out which items are covered by each tenderTransaction?

ShopifyDevSup
Shopify Staff
1453 238 531

Hey @srcb - transactions are associated at the order-level only and not with specific line items. If you are billing for line items separately though (for example each item is paid for with a separate transaction), you could use the transaction resource, for example, to compare against the line item cost on the order object. If you'd like share a use case - we'd be happy to see if we can look into a different workaround if possible, though. Hope to hear from you soon - let us know if we can clarify anything on our end. 

 

Al | Shopify Developer Support 

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

srcb
Shopify Partner
10 0 2

@ShopifyDevSup What I really want is to match transactions to Agreements (in graphQL), let's look at a sample use case.

1. customer makes an order.
2. customer pays for the order.
3. customer edits the order, either adding items, or exchanging items.
4. customer pays for the new/upgraded items

Usually I can match transactions to agreements, however, sometimes the user uses a gift card, in which case the transactions don't match any agreement. Sure I can code for this edge case and guess to which agreement the gift card goes to, but I've realized that sometimes Shopify's Authorize and Capture transaction amounts don't match. In this case, there will be 2 transactions when querying the transaction resource, a transaction of type charge for the amount of the authorization, and a transaction of type refund for the difference. Again, I can code for this edge case, but then again, which edge cases have I missed? So is there a way to see exactly which transactions cover which agreement?

In short, what I want to do is match agreements to transactions, however sometimes there are multiple transactions covering the same agreement, and I need to try and guess which transactions cover which agreements. Is there a way for me to easily see which transactions belong together?